diff --git a/.classpath b/.classpath index ea03344..7242b9c 100644 --- a/.classpath +++ b/.classpath @@ -14,6 +14,6 @@ - + diff --git a/analyseWriter.jar b/analyseWriter.jar index 624a880..f0c925f 100644 Binary files a/analyseWriter.jar and b/analyseWriter.jar differ diff --git a/bin/.gitignore b/bin/.gitignore index c7bc614..4c2dcb6 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -1,5 +1,2 @@ -/MEPTL/ /app/ -/calcul/ -/setting$1.class -/setting.class +/MEPTL/ diff --git a/bin/MEPTL/commandes.class b/bin/MEPTL/commandes.class index be31b27..911e6c0 100644 Binary files a/bin/MEPTL/commandes.class and b/bin/MEPTL/commandes.class differ diff --git a/bin/app/create$10.class b/bin/app/create$10.class index 429bd81..d0ba36f 100644 Binary files a/bin/app/create$10.class and b/bin/app/create$10.class differ diff --git a/bin/app/create$11.class b/bin/app/create$11.class index 478e818..969a8e2 100644 Binary files a/bin/app/create$11.class and b/bin/app/create$11.class differ diff --git a/bin/app/create$12.class b/bin/app/create$12.class index e26ea02..4b0040e 100644 Binary files a/bin/app/create$12.class and b/bin/app/create$12.class differ diff --git a/bin/app/create$13.class b/bin/app/create$13.class index 638c643..39f4a28 100644 Binary files a/bin/app/create$13.class and b/bin/app/create$13.class differ diff --git a/bin/app/create$14.class b/bin/app/create$14.class index 84dd349..db70e80 100644 Binary files a/bin/app/create$14.class and b/bin/app/create$14.class differ diff --git a/bin/app/create$15.class b/bin/app/create$15.class index 7e6197b..5b60198 100644 Binary files a/bin/app/create$15.class and b/bin/app/create$15.class differ diff --git a/bin/app/create$16.class b/bin/app/create$16.class index 5ee2aa0..cdb0986 100644 Binary files a/bin/app/create$16.class and b/bin/app/create$16.class differ diff --git a/bin/app/create$17.class b/bin/app/create$17.class index 0d7f497..1a12f80 100644 Binary files a/bin/app/create$17.class and b/bin/app/create$17.class differ diff --git a/bin/app/create$18.class b/bin/app/create$18.class index 33aec73..df85f51 100644 Binary files a/bin/app/create$18.class and b/bin/app/create$18.class differ diff --git a/bin/app/create$19.class b/bin/app/create$19.class index 3f5a1d2..de90339 100644 Binary files a/bin/app/create$19.class and b/bin/app/create$19.class differ diff --git a/bin/app/create$20.class b/bin/app/create$20.class index 5dd970b..92133cd 100644 Binary files a/bin/app/create$20.class and b/bin/app/create$20.class differ diff --git a/bin/app/create$21.class b/bin/app/create$21.class index a5429fa..75b9f8b 100644 Binary files a/bin/app/create$21.class and b/bin/app/create$21.class differ diff --git a/bin/app/create$22.class b/bin/app/create$22.class index 6fd3de2..08bd973 100644 Binary files a/bin/app/create$22.class and b/bin/app/create$22.class differ diff --git a/bin/app/create$23.class b/bin/app/create$23.class index 82c5467..af27827 100644 Binary files a/bin/app/create$23.class and b/bin/app/create$23.class differ diff --git a/bin/app/create$24.class b/bin/app/create$24.class index 38b161e..4a11a93 100644 Binary files a/bin/app/create$24.class and b/bin/app/create$24.class differ diff --git a/bin/app/create$25.class b/bin/app/create$25.class index 69e529d..65c5304 100644 Binary files a/bin/app/create$25.class and b/bin/app/create$25.class differ diff --git a/bin/app/create$26.class b/bin/app/create$26.class index 0e16997..b24d4d0 100644 Binary files a/bin/app/create$26.class and b/bin/app/create$26.class differ diff --git a/bin/app/create$27.class b/bin/app/create$27.class index a150f37..977226c 100644 Binary files a/bin/app/create$27.class and b/bin/app/create$27.class differ diff --git a/bin/app/create$28.class b/bin/app/create$28.class index 106e66b..f514a24 100644 Binary files a/bin/app/create$28.class and b/bin/app/create$28.class differ diff --git a/bin/app/create$29.class b/bin/app/create$29.class index 215077b..1790074 100644 Binary files a/bin/app/create$29.class and b/bin/app/create$29.class differ diff --git a/bin/app/create$30.class b/bin/app/create$30.class index c35ec31..e10ffea 100644 Binary files a/bin/app/create$30.class and b/bin/app/create$30.class differ diff --git a/bin/app/create$31.class b/bin/app/create$31.class index 0c19f1f..28aea8b 100644 Binary files a/bin/app/create$31.class and b/bin/app/create$31.class differ diff --git a/bin/app/create$32.class b/bin/app/create$32.class index 72dfe6a..5e24367 100644 Binary files a/bin/app/create$32.class and b/bin/app/create$32.class differ diff --git a/bin/app/create$33.class b/bin/app/create$33.class index baecf91..d38d55a 100644 Binary files a/bin/app/create$33.class and b/bin/app/create$33.class differ diff --git a/bin/app/create$34.class b/bin/app/create$34.class index fb47066..b444c46 100644 Binary files a/bin/app/create$34.class and b/bin/app/create$34.class differ diff --git a/bin/app/create$35.class b/bin/app/create$35.class index 4147fc8..3b2237a 100644 Binary files a/bin/app/create$35.class and b/bin/app/create$35.class differ diff --git a/bin/app/create$36.class b/bin/app/create$36.class index 76f5a06..5615000 100644 Binary files a/bin/app/create$36.class and b/bin/app/create$36.class differ diff --git a/bin/app/create$37.class b/bin/app/create$37.class index 9b5f0f7..9f63b81 100644 Binary files a/bin/app/create$37.class and b/bin/app/create$37.class differ diff --git a/bin/app/create$38.class b/bin/app/create$38.class index 43ac929..c52f22a 100644 Binary files a/bin/app/create$38.class and b/bin/app/create$38.class differ diff --git a/bin/app/create$39.class b/bin/app/create$39.class index 75de58b..40eeb0e 100644 Binary files a/bin/app/create$39.class and b/bin/app/create$39.class differ diff --git a/bin/app/create$40.class b/bin/app/create$40.class index 9834cf2..56fd3f5 100644 Binary files a/bin/app/create$40.class and b/bin/app/create$40.class differ diff --git a/bin/app/create$41.class b/bin/app/create$41.class index dba8988..6889d8c 100644 Binary files a/bin/app/create$41.class and b/bin/app/create$41.class differ diff --git a/bin/app/create$42.class b/bin/app/create$42.class index 3cfbea0..23db14a 100644 Binary files a/bin/app/create$42.class and b/bin/app/create$42.class differ diff --git a/bin/app/create$43.class b/bin/app/create$43.class index 3f93c13..1dddb80 100644 Binary files a/bin/app/create$43.class and b/bin/app/create$43.class differ diff --git a/bin/app/create$44.class b/bin/app/create$44.class index 1a7e304..b396d90 100644 Binary files a/bin/app/create$44.class and b/bin/app/create$44.class differ diff --git a/bin/app/create$45.class b/bin/app/create$45.class index d151cfd..2f908a6 100644 Binary files a/bin/app/create$45.class and b/bin/app/create$45.class differ diff --git a/bin/app/create$46.class b/bin/app/create$46.class index 3fab525..0ae2039 100644 Binary files a/bin/app/create$46.class and b/bin/app/create$46.class differ diff --git a/bin/app/create$47.class b/bin/app/create$47.class index 5cdd098..5677763 100644 Binary files a/bin/app/create$47.class and b/bin/app/create$47.class differ diff --git a/bin/app/create$48.class b/bin/app/create$48.class index e1e8f88..4c4e904 100644 Binary files a/bin/app/create$48.class and b/bin/app/create$48.class differ diff --git a/bin/app/create$49.class b/bin/app/create$49.class index 7286dc3..412a9ee 100644 Binary files a/bin/app/create$49.class and b/bin/app/create$49.class differ diff --git a/bin/app/create$50.class b/bin/app/create$50.class index b8f5e55..69d8067 100644 Binary files a/bin/app/create$50.class and b/bin/app/create$50.class differ diff --git a/bin/app/create$51.class b/bin/app/create$51.class index a4079e2..350fd93 100644 Binary files a/bin/app/create$51.class and b/bin/app/create$51.class differ diff --git a/bin/app/create$52.class b/bin/app/create$52.class index 66e9be5..da50194 100644 Binary files a/bin/app/create$52.class and b/bin/app/create$52.class differ diff --git a/bin/app/create$53.class b/bin/app/create$53.class index bcd641d..b8dcee8 100644 Binary files a/bin/app/create$53.class and b/bin/app/create$53.class differ diff --git a/bin/app/create$54.class b/bin/app/create$54.class index 2842834..3edfa7f 100644 Binary files a/bin/app/create$54.class and b/bin/app/create$54.class differ diff --git a/bin/app/create$55.class b/bin/app/create$55.class index f7625bd..9c5627e 100644 Binary files a/bin/app/create$55.class and b/bin/app/create$55.class differ diff --git a/bin/app/create$56.class b/bin/app/create$56.class index 4df4661..9c22b38 100644 Binary files a/bin/app/create$56.class and b/bin/app/create$56.class differ diff --git a/bin/app/create$57.class b/bin/app/create$57.class index 02e9336..7001372 100644 Binary files a/bin/app/create$57.class and b/bin/app/create$57.class differ diff --git a/bin/app/create$58.class b/bin/app/create$58.class index 0e52f0c..273a931 100644 Binary files a/bin/app/create$58.class and b/bin/app/create$58.class differ diff --git a/bin/app/create$7.class b/bin/app/create$7.class index ee0e862..ec65f10 100644 Binary files a/bin/app/create$7.class and b/bin/app/create$7.class differ diff --git a/bin/app/create$8.class b/bin/app/create$8.class index 482339e..b5cb284 100644 Binary files a/bin/app/create$8.class and b/bin/app/create$8.class differ diff --git a/bin/app/create$9.class b/bin/app/create$9.class index a3123d0..f96f392 100644 Binary files a/bin/app/create$9.class and b/bin/app/create$9.class differ diff --git a/bin/app/create.class b/bin/app/create.class index a64cc99..f6f7e11 100644 Binary files a/bin/app/create.class and b/bin/app/create.class differ diff --git a/bin/atraversanalysestyle.png b/bin/atraversanalysestyle.png new file mode 100644 index 0000000..6593a5a Binary files /dev/null and b/bin/atraversanalysestyle.png differ diff --git a/bin/atraversanalysestyle.svg b/bin/atraversanalysestyle.svg new file mode 100644 index 0000000..edad5ea --- /dev/null +++ b/bin/atraversanalysestyle.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + S + + + + + + diff --git a/bin/atraversanalysestylemini.png b/bin/atraversanalysestylemini.png new file mode 100644 index 0000000..e4d8607 Binary files /dev/null and b/bin/atraversanalysestylemini.png differ diff --git a/bin/calcul/formatDateWriter.class b/bin/calcul/formatDateWriter.class new file mode 100644 index 0000000..077b8c9 Binary files /dev/null and b/bin/calcul/formatDateWriter.class differ diff --git a/bin/calcul/listeAttributWriterPasEvaluableAvecCodeEvaluateur.class b/bin/calcul/listeAttributWriterPasEvaluableAvecCodeEvaluateur.class new file mode 100644 index 0000000..a3336a5 Binary files /dev/null and b/bin/calcul/listeAttributWriterPasEvaluableAvecCodeEvaluateur.class differ diff --git a/bin/calcul/listeAttributWriterValeurPasModifiable.class b/bin/calcul/listeAttributWriterValeurPasModifiable.class new file mode 100644 index 0000000..14579e4 Binary files /dev/null and b/bin/calcul/listeAttributWriterValeurPasModifiable.class differ diff --git a/bin/calcul/listeNodeFormatageDirectDeWriter.class b/bin/calcul/listeNodeFormatageDirectDeWriter.class new file mode 100644 index 0000000..77cd9b3 Binary files /dev/null and b/bin/calcul/listeNodeFormatageDirectDeWriter.class differ diff --git a/bin/resources/couleur.png b/bin/resources/couleur.png new file mode 100644 index 0000000..6762b3d Binary files /dev/null and b/bin/resources/couleur.png differ diff --git a/bin/resources/couleurmini.png b/bin/resources/couleurmini.png new file mode 100644 index 0000000..5e82950 Binary files /dev/null and b/bin/resources/couleurmini.png differ diff --git a/bin/resources/similitude.png b/bin/resources/similitude.png new file mode 100644 index 0000000..6b2887e Binary files /dev/null and b/bin/resources/similitude.png differ diff --git a/bin/resources/similitudemini.png b/bin/resources/similitudemini.png new file mode 100644 index 0000000..89e7c70 Binary files /dev/null and b/bin/resources/similitudemini.png differ diff --git a/bin/resources/traduction.png b/bin/resources/traduction.png new file mode 100644 index 0000000..e58237e Binary files /dev/null and b/bin/resources/traduction.png differ diff --git a/bin/resources/traductionmini.png b/bin/resources/traductionmini.png new file mode 100644 index 0000000..d9a0805 Binary files /dev/null and b/bin/resources/traductionmini.png differ diff --git a/bin/resources/triche.png b/bin/resources/triche.png new file mode 100644 index 0000000..f649dca Binary files /dev/null and b/bin/resources/triche.png differ diff --git a/bin/resources/trichemini.png b/bin/resources/trichemini.png new file mode 100644 index 0000000..4ff1d60 Binary files /dev/null and b/bin/resources/trichemini.png differ diff --git a/bin/resources/zip.png b/bin/resources/zip.png new file mode 100644 index 0000000..a196233 Binary files /dev/null and b/bin/resources/zip.png differ diff --git a/bin/resources/zipmini.png b/bin/resources/zipmini.png new file mode 100644 index 0000000..516c7ab Binary files /dev/null and b/bin/resources/zipmini.png differ diff --git a/bin/treeClose.png b/bin/treeClose.png new file mode 100644 index 0000000..37244f0 Binary files /dev/null and b/bin/treeClose.png differ diff --git a/bin/treeClose.svg b/bin/treeClose.svg new file mode 100644 index 0000000..8654a32 --- /dev/null +++ b/bin/treeClose.svg @@ -0,0 +1,268 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/bin/treeLeaf.png b/bin/treeLeaf.png new file mode 100644 index 0000000..c7961a0 Binary files /dev/null and b/bin/treeLeaf.png differ diff --git a/bin/treeLeaf.svg b/bin/treeLeaf.svg new file mode 100644 index 0000000..3ce910c --- /dev/null +++ b/bin/treeLeaf.svg @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/icons/couleur.png b/icons/couleur.png new file mode 100644 index 0000000..6762b3d Binary files /dev/null and b/icons/couleur.png differ diff --git a/icons/couleur.svg b/icons/couleur.svg new file mode 100644 index 0000000..6fe6464 --- /dev/null +++ b/icons/couleur.svg @@ -0,0 +1,296 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/icons/couleurmini.png b/icons/couleurmini.png new file mode 100644 index 0000000..5e82950 Binary files /dev/null and b/icons/couleurmini.png differ diff --git a/icons/similitude.png b/icons/similitude.png new file mode 100644 index 0000000..6b2887e Binary files /dev/null and b/icons/similitude.png differ diff --git a/icons/similitude.svg b/icons/similitude.svg new file mode 100644 index 0000000..42d53ce --- /dev/null +++ b/icons/similitude.svg @@ -0,0 +1,303 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + A a + + + + + diff --git a/icons/similitudemini.png b/icons/similitudemini.png new file mode 100644 index 0000000..89e7c70 Binary files /dev/null and b/icons/similitudemini.png differ diff --git a/icons/traduction.png b/icons/traduction.png new file mode 100644 index 0000000..e58237e Binary files /dev/null and b/icons/traduction.png differ diff --git a/icons/traduction.svg b/icons/traduction.svg new file mode 100644 index 0000000..a9ec84d --- /dev/null +++ b/icons/traduction.svg @@ -0,0 +1,265 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + XML + + + A + + + + + diff --git a/icons/traductionmini.png b/icons/traductionmini.png new file mode 100644 index 0000000..d9a0805 Binary files /dev/null and b/icons/traductionmini.png differ diff --git a/icons/triche.png b/icons/triche.png new file mode 100644 index 0000000..f649dca Binary files /dev/null and b/icons/triche.png differ diff --git a/icons/triche.svg b/icons/triche.svg new file mode 100644 index 0000000..6c7f0c0 --- /dev/null +++ b/icons/triche.svg @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/icons/trichemini.png b/icons/trichemini.png new file mode 100644 index 0000000..4ff1d60 Binary files /dev/null and b/icons/trichemini.png differ diff --git a/icons/zip.png b/icons/zip.png new file mode 100644 index 0000000..a196233 Binary files /dev/null and b/icons/zip.png differ diff --git a/icons/zip.svg b/icons/zip.svg new file mode 100644 index 0000000..383e495 --- /dev/null +++ b/icons/zip.svg @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + ZIP + + + diff --git a/icons/zipmini.png b/icons/zipmini.png new file mode 100644 index 0000000..516c7ab Binary files /dev/null and b/icons/zipmini.png differ diff --git a/src/MEPTL/commandes.java b/src/MEPTL/commandes.java index f3206b6..e284b3b 100644 --- a/src/MEPTL/commandes.java +++ b/src/MEPTL/commandes.java @@ -33,7 +33,7 @@ public class commandes { public static node nodeCSV = null; //**version - public static String version ="V4.1.1"; // La version actuelle + public static String version ="V4.1.2"; // La version actuelle public static String branch = "Origin"; public static String Annee ="2022"; diff --git a/src/app/create.java b/src/app/create.java index 7b9bde1..2b8df97 100644 --- a/src/app/create.java +++ b/src/app/create.java @@ -841,7 +841,6 @@ public class create extends JFrame { } }; - /** diff --git a/src/app/setting.java b/src/app/setting.java index d33873b..bb28b66 100644 --- a/src/app/setting.java +++ b/src/app/setting.java @@ -5,8 +5,11 @@ import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; +import javax.swing.filechooser.FileNameExtensionFilter; import MEPTL.commandes; +import MEPTL.verificationFichierAnalyse; +import cXML.Run; import cXML.node; import javax.swing.JTabbedPane; @@ -15,11 +18,22 @@ import javax.swing.JOptionPane; import javax.swing.SwingConstants; import java.awt.Font; import javax.swing.JComboBox; +import javax.swing.JFileChooser; import javax.swing.DefaultComboBoxModel; import javax.swing.JTextField; import javax.swing.JButton; import java.awt.event.ActionListener; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.awt.event.ActionEvent; +import java.awt.GridLayout; +import java.awt.Color; +import javax.swing.UIManager; public class setting extends JFrame { @@ -34,7 +48,33 @@ public class setting extends JFrame { private JTextField textFieldIDEtudiant; private JComboBox comboBoxSeparateur; private JComboBox comboBoxEncodage; - private JButton btnValiderCSV; + private JButton btnValiderModifications; + private JButton btnReinit; + private JButton btnTestCouleur; + private JTextField textFieldSize; + private JTextField textFieldNameZIP; + private JTextField textFieldMiniCorrespondance; + private JTextField textFieldNbrMiniModification; + private JTextField textFieldMaxiModificationSimul; + private JTextField textFieldTextSimilitude; + private JTextField textFieldRouge; + private JTextField textFieldVert; + private JTextField textFieldBleu; + private JTextField textFieldTestCouleur; + private JButton btnExtraire; + + // Bouton couleur de test + JButton btnCouleurInitTest; + JButton btnRougeMax; + JButton btnRougeMini; + JButton btnVertMax; + JButton btnVertMini; + JButton btnBleuMini; + JButton btnBleuMax; + JButton btnCouleurMiniTotal; + JButton btnCouleurMaxiTotal; + JButton btnAjouterVosTraductions; + /** * Create the frame. */ @@ -58,18 +98,26 @@ public class setting extends JFrame { int screenHeight = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight(); setLocation(( (screenWidth) - getWidth()) / 2, (screenHeight - getHeight()) / 2); - ImageIcon img1 = new ImageIcon(getClass().getResource("/fichierCSV.png") ); - ImageIcon img3 = new ImageIcon(getClass().getResource("/property.png") ); - ImageIcon img4 = new ImageIcon(getClass().getResource("/content.png") ); - ImageIcon img2 = new ImageIcon(getClass().getResource("/structurepage.png") ); + ImageIcon img1 = new ImageIcon(getClass().getResource("/resources/fichierCSV.png") ); + ImageIcon img2 = new ImageIcon(getClass().getResource("/resources/zip.png") ); + ImageIcon img3 = new ImageIcon(getClass().getResource("/resources/triche.png") ); + ImageIcon img4 = new ImageIcon(getClass().getResource("/resources/similitude.png") ); + ImageIcon img5 = new ImageIcon(getClass().getResource("/resources/couleur.png") ); + ImageIcon img6 = new ImageIcon(getClass().getResource("/resources/traduction.png") ); + + + //********************************************************* + //** CSV ** + //********************************************************* JPanel panelCSV = new JPanel(); - tabbedPane.addTab("Fichier CSV", img1, panelCSV, null); + tabbedPane.addTab("CSV", img1, panelCSV, null); panelCSV.setLayout(null); node nodCSV = commandes.sujet.retourneFirstEnfantsByName("csv"); if(nodCSV==null) { - JOptionPane.showMessageDialog(null, "Problème avec le fichier d'analyse.
Le node CSV n'est pas dans le fichier."); + JOptionPane.showMessageDialog(null, "Problème avec le fichier d'analyse.
Le node csv n'est pas dans le fichier."); + dispose(); return; } @@ -77,7 +125,7 @@ public class setting extends JFrame { lblNewLabel.setVerticalAlignment(SwingConstants.TOP); lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblNewLabel.setHorizontalAlignment(SwingConstants.LEFT); - lblNewLabel.setBounds(10, 11, 691, 42); + lblNewLabel.setBounds(10, 10, 691, 46); panelCSV.add(lblNewLabel); JLabel lblEncodage = new JLabel("Encodage"); @@ -166,33 +214,388 @@ public class setting extends JFrame { textFieldIDEtudiant.setText(nodImportMoodle.getAttributs().get("id")); panelCSV.add(textFieldIDEtudiant); - btnValiderCSV = new JButton("Valider"); - btnValiderCSV.setFont(new Font("Tahoma", Font.BOLD, 12)); - btnValiderCSV.setBounds(535, 430, 145, 37); - panelCSV.add(btnValiderCSV); + + //********************************************************* + //** ZIP ** + //********************************************************* JPanel panelZip = new JPanel(); panelZip.setLayout(null); - tabbedPane.addTab("ZIP", img1, panelZip, null); + tabbedPane.addTab("ZIP", img2, panelZip, null); + node nodZIP = commandes.sujet.retourneFirstEnfantsByName("zip"); + if(nodZIP==null) { + JOptionPane.showMessageDialog(null, "Problème avec le fichier d'analyse.
Le node zip n'est pas dans le fichier."); + dispose(); + return; + } + + + JLabel lblZIP = new JLabel("Ces paramètres permettent de réaliser les archives au format ZIP contenant les feedbacks des étudiants.
\r\nCes paramètres sont enregistrés dans le fichier d'analyse."); + lblZIP.setHorizontalAlignment(SwingConstants.LEFT); + lblZIP.setVerticalAlignment(SwingConstants.TOP); + lblZIP.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblZIP.setBounds(10, 10, 691, 46); + panelZip.add(lblZIP); + + JLabel lblSize = new JLabel("Taille maximale (Mo)"); + lblSize.setFont(new Font("Tahoma", Font.BOLD, 12)); + lblSize.setBounds(60, 96, 134, 20); + panelZip.add(lblSize); + + textFieldSize = new JTextField(); + textFieldSize.setFont(new Font("Tahoma", Font.BOLD, 12)); + textFieldSize.setBounds(198, 94, 86, 22); + Integer size = 0; + try { + size = Integer.valueOf(nodZIP.getAttributs().get("size")); + size = size/1000000; + size = size + 2; + }catch (Exception e) { + JOptionPane.showInternalMessageDialog(null, "Il y a un problème avec la taille de l'archive dans le fichier d'analyse."); + dispose(); + return; + } + textFieldSize.setText(String.valueOf(size)); + textFieldSize.setColumns(10); + panelZip.add(textFieldSize); + + JLabel lblNewLabel_1_1 = new JLabel("Nom de l'archive"); + lblNewLabel_1_1.setFont(new Font("Tahoma", Font.BOLD, 12)); + lblNewLabel_1_1.setBounds(60, 164, 134, 20); + panelZip.add(lblNewLabel_1_1); + + textFieldNameZIP = new JTextField(); + textFieldNameZIP.setFont(new Font("Tahoma", Font.BOLD, 12)); + textFieldNameZIP.setColumns(10); + textFieldNameZIP.setBounds(198, 164, 187, 22); + textFieldNameZIP.setText(nodZIP.getAttributs().get("nameZip")); + panelZip.add(textFieldNameZIP); + + JLabel lblNewLabel_1 = new JLabel("La taille maximale sur moodle est limitée à 50Mo."); + lblNewLabel_1.setBounds(311, 97, 349, 20); + panelZip.add(lblNewLabel_1); + + JLabel lblNewLabel_1_2 = new JLabel("Ne saisissez pas de caractère spéciaux."); + lblNewLabel_1_2.setBounds(406, 165, 254, 20); + panelZip.add(lblNewLabel_1_2); + + + + //********************************************************* + //** TRICHE ** + //********************************************************* JPanel panelPlagiarism = new JPanel(); panelPlagiarism.setLayout(null); - tabbedPane.addTab("Triche", img2, panelPlagiarism, null); - + tabbedPane.addTab("Triche", img3, panelPlagiarism, null); + + node nodTriche = commandes.sujet.retourneFirstEnfantsByName("plagiarism"); + if(nodTriche==null) { + JOptionPane.showMessageDialog(null, "Problème avec le fichier d'analyse.
Le node plagiarism n'est pas dans le fichier."); + dispose(); + return; + } + + + JLabel lbldurantVosContrles = new JLabel("Pour vérifier d'éventuelles triches, les fichiers des étudiants doivent enregistrer les modifications.

" + + "Durant vos contrôles, des étudiants peuvent transmettre leurs fichiers à d'autres étudiants. Ils peuvent aussi réaliser des copiés et collés entre les fichiers.

" + + "Pour limiter les risques, remettez à vos étudiants un fichier avec le mode suivi des modifications activé et protégé par un mot de passe.

" + + "Si vous avez oublié de demander, dans vos consignes, de changer dans les options le nom et le prénom de l'auteur." + + " Alors, il est possible (mais très peu probable) qu'une modification identique se produise dans deux fichiers.

" + + "Les paramètres ci-dessous permettent d'avoir une tolérances sur le signalement d'une éventuelle triche."); + lbldurantVosContrles.setVerticalAlignment(SwingConstants.TOP); + lbldurantVosContrles.setHorizontalAlignment(SwingConstants.LEFT); + lbldurantVosContrles.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lbldurantVosContrles.setBounds(10, 10, 691, 226); + panelPlagiarism.add(lbldurantVosContrles); + + JLabel lblNbrCorrespondanceMinimale = new JLabel("Nombre minimale de correspondance entre fichier"); + lblNbrCorrespondanceMinimale.setFont(new Font("Tahoma", Font.BOLD, 12)); + lblNbrCorrespondanceMinimale.setBounds(40, 247, 313, 20); + panelPlagiarism.add(lblNbrCorrespondanceMinimale); + + textFieldMiniCorrespondance = new JTextField(); + textFieldMiniCorrespondance.setFont(new Font("Tahoma", Font.BOLD, 12)); + textFieldMiniCorrespondance.setColumns(10); + textFieldMiniCorrespondance.setBounds(364, 247, 56, 22); + textFieldMiniCorrespondance.setText(nodTriche.getAttributs().get("number_match")); + panelPlagiarism.add(textFieldMiniCorrespondance); + + JLabel lblNbrMiniModification = new JLabel("Nombre minimale de modification"); + lblNbrMiniModification.setFont(new Font("Tahoma", Font.BOLD, 12)); + lblNbrMiniModification.setBounds(43, 293, 239, 20); + panelPlagiarism.add(lblNbrMiniModification); + + textFieldNbrMiniModification = new JTextField(); + textFieldNbrMiniModification.setFont(new Font("Tahoma", Font.BOLD, 12)); + textFieldNbrMiniModification.setColumns(10); + textFieldNbrMiniModification.setBounds(364, 293, 56, 22); + textFieldNbrMiniModification.setText(nodTriche.getAttributs().get("mini_number_modification")); + panelPlagiarism.add(textFieldNbrMiniModification); + + JLabel lblNewLabel_2 = new JLabel("L'étudiants n'a pas réaliser assez de travaux.
" + + "si valuer = -1 alors n'est pas pris en compte."); + lblNewLabel_2.setFont(new Font("Tahoma", Font.PLAIN, 11)); + lblNewLabel_2.setVerticalAlignment(SwingConstants.TOP); + lblNewLabel_2.setBounds(430, 297, 239, 41); + panelPlagiarism.add(lblNewLabel_2); + + JLabel lblNewLabel_2_1 = new JLabel("Zéro = aucune tolérance"); + lblNewLabel_2_1.setFont(new Font("Tahoma", Font.PLAIN, 11)); + lblNewLabel_2_1.setBounds(430, 247, 239, 20); + panelPlagiarism.add(lblNewLabel_2_1); + + JLabel lblNbrMaxiModificationSimul = new JLabel("Nombre maximale de modification simultanée"); + lblNbrMaxiModificationSimul.setFont(new Font("Tahoma", Font.BOLD, 12)); + lblNbrMaxiModificationSimul.setBounds(40, 373, 313, 20); + panelPlagiarism.add(lblNbrMaxiModificationSimul); + + textFieldMaxiModificationSimul = new JTextField(); + textFieldMaxiModificationSimul.setFont(new Font("Tahoma", Font.BOLD, 12)); + textFieldMaxiModificationSimul.setColumns(10); + textFieldMaxiModificationSimul.setBounds(364, 373, 56, 22); + textFieldMaxiModificationSimul.setText(nodTriche.getAttributs().get("nombres_modifications_simultané_maxi")); + panelPlagiarism.add(textFieldMaxiModificationSimul); + + JLabel lblNewLabel_2_2 = new JLabel("Evite le copié collé de tout l'exercice,
ou d'une partie de l'exercice.
" + + "Cette valeur dépend de votre exercice."); + lblNewLabel_2_2.setFont(new Font("Tahoma", Font.PLAIN, 11)); + lblNewLabel_2_2.setVerticalAlignment(SwingConstants.TOP); + lblNewLabel_2_2.setBounds(430, 377, 239, 83); + panelPlagiarism.add(lblNewLabel_2_2); + + + //********************************************************* + //** SIMILITUDE ** + //********************************************************* JPanel panelTextSimilarity = new JPanel(); panelTextSimilarity.setLayout(null); - tabbedPane.addTab("Texte similitude", img4, panelTextSimilarity, null); + tabbedPane.addTab("Textes", img4, panelTextSimilarity, null); + node nodSimilitude = commandes.sujet.retourneFirstEnfantsByName("text:similarity"); + if(nodSimilitude==null) { + JOptionPane.showMessageDialog(null, "Problème avec le fichier d'analyse.
Le node text:similarity n'est pas dans le fichier."); + dispose(); + return; + } + + JLabel lbllesSimilitude = new JLabel("Les méthodes par comparaison des chaînes de caractères utilisent la distance de Levenshtein d=[0;1].
" + + "Exemple : allContent=\"environ1\", ou \"value\".

" + + "La valeur du paramètre \"texte similitude\" par défaut est de 0.79 pour la méthode envirion, les fonctions dans les attributs de Writer.
" + + ""); + lbllesSimilitude.setVerticalAlignment(SwingConstants.TOP); + lbllesSimilitude.setHorizontalAlignment(SwingConstants.LEFT); + lbllesSimilitude.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lbllesSimilitude.setBounds(10, 10, 691, 96); + panelTextSimilarity.add(lbllesSimilitude); + + JLabel lblNewLabel_4 = new JLabel("Texte similitude"); + lblNewLabel_4.setFont(new Font("Tahoma", Font.BOLD, 12)); + lblNewLabel_4.setBounds(57, 159, 160, 20); + panelTextSimilarity.add(lblNewLabel_4); + + textFieldTextSimilitude = new JTextField(); + textFieldTextSimilitude.setFont(new Font("Tahoma", Font.BOLD, 12)); + textFieldTextSimilitude.setBounds(199, 159, 86, 22); + textFieldTextSimilitude.setText(nodSimilitude.getAttributs().get("tolerance_text")); + panelTextSimilarity.add(textFieldTextSimilitude); + textFieldTextSimilitude.setColumns(10); + + JLabel lblNewLabel_5 = new JLabel("C'est la distance minimale qu'il doit y avoir entre le texte (paragraphe, ensemble de paragraphe, valeur d'un attribut Writer) et le texte présent dans le fichier d'analyse.

" + + "La distance est une valeur comprise entre 0 et 1.

" + + "Si d=0 alors n'importe quel texte est accepté.
" + + "Si d=1 alors aucune différence entre les textes."); + lblNewLabel_5.setFont(new Font("Tahoma", Font.PLAIN, 11)); + lblNewLabel_5.setVerticalAlignment(SwingConstants.TOP); + lblNewLabel_5.setBounds(325, 163, 376, 145); + panelTextSimilarity.add(lblNewLabel_5); + + + //********************************************************* + //** COULEUR ** + //********************************************************* JPanel panelColor = new JPanel(); panelColor.setLayout(null); - tabbedPane.addTab("Couleur", img4, panelColor, null); + tabbedPane.addTab("Couleur", img5, panelColor, null); + node nodColor = commandes.sujet.retourneFirstEnfantsByName("color"); + if(nodColor==null) { + JOptionPane.showMessageDialog(null, "Problème avec le fichier d'analyse.
Le node color n'est pas dans le fichier."); + dispose(); + return; + } + + JLabel lblCouleur = new JLabel("Dans les attributs de Writer contenant un code couleur, vous pouvez régler la tolérance de la couleur sur les trois canaux RVB.
" + + "Il y a 255 nuances sur chaque canal.
" + + "Par défaut les valeurs des tolérances sont réglées à 30 nuances."); + lblCouleur.setVerticalAlignment(SwingConstants.TOP); + lblCouleur.setHorizontalAlignment(SwingConstants.LEFT); + lblCouleur.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblCouleur.setBounds(10, 10, 691, 97); + panelColor.add(lblCouleur); + + JLabel lblRouge = new JLabel("Valeur de la tolérance sur les rouges"); + lblRouge.setToolTipText(""); + lblRouge.setFont(new Font("Tahoma", Font.BOLD, 12)); + lblRouge.setBounds(30, 165, 250, 20); + panelColor.add(lblRouge); + + JLabel lblValeurDeLa = new JLabel("Valeur de la tolérance sur les verts"); + lblValeurDeLa.setToolTipText(""); + lblValeurDeLa.setFont(new Font("Tahoma", Font.BOLD, 12)); + lblValeurDeLa.setBounds(30, 218, 250, 20); + panelColor.add(lblValeurDeLa); + + JLabel lblValeurDeLa_2 = new JLabel("Valeur de la tolérance sur les bleus"); + lblValeurDeLa_2.setToolTipText(""); + lblValeurDeLa_2.setFont(new Font("Tahoma", Font.BOLD, 12)); + lblValeurDeLa_2.setBounds(30, 275, 244, 20); + panelColor.add(lblValeurDeLa_2); + + textFieldRouge = new JTextField(); + textFieldRouge.setFont(new Font("Tahoma", Font.BOLD, 12)); + textFieldRouge.setBounds(292, 165, 86, 22); + panelColor.add(textFieldRouge); + textFieldRouge.setText(nodColor.getAttributs().get("tolerance_rouge")); + textFieldRouge.setColumns(10); + + textFieldVert = new JTextField(); + textFieldVert.setFont(new Font("Tahoma", Font.BOLD, 12)); + textFieldVert.setColumns(10); + textFieldVert.setText(nodColor.getAttributs().get("tolerance_vert")); + textFieldVert.setBounds(292, 219, 86, 22); + panelColor.add(textFieldVert); + + textFieldBleu = new JTextField(); + textFieldBleu.setFont(new Font("Tahoma", Font.BOLD, 12)); + textFieldBleu.setColumns(10); + textFieldBleu.setText(nodColor.getAttributs().get("tolerance_bleu")); + textFieldBleu.setBounds(292, 276, 86, 22); + panelColor.add(textFieldBleu); + + btnTestCouleur = new JButton("Test de tolérance"); + btnTestCouleur.setBounds(396, 353, 173, 23); + panelColor.add(btnTestCouleur); + + textFieldTestCouleur = new JTextField(); + textFieldTestCouleur.setHorizontalAlignment(SwingConstants.CENTER); + textFieldTestCouleur.setText("#ff0000"); + textFieldTestCouleur.setFont(new Font("Tahoma", Font.BOLD, 12)); + textFieldTestCouleur.setColumns(10); + textFieldTestCouleur.setBounds(292, 354, 86, 22); + panelColor.add(textFieldTestCouleur); + + JLabel lblValeurDeLa_2_1 = new JLabel("Tapez un code couleur hexadécimal"); + lblValeurDeLa_2_1.setToolTipText(""); + lblValeurDeLa_2_1.setFont(new Font("Tahoma", Font.BOLD, 12)); + lblValeurDeLa_2_1.setBounds(30, 357, 244, 20); + panelColor.add(lblValeurDeLa_2_1); + + btnCouleurInitTest = new JButton("Couleur"); + Color couleurInit = hex2Rgb(textFieldTestCouleur.getText()); + btnCouleurInitTest.setBackground(couleurInit); + btnCouleurInitTest.setBounds(119, 430, 89, 23); + panelColor.add(btnCouleurInitTest); + + btnRougeMax = new JButton("Rouge max"); + btnRougeMax.setBackground(new Color(153, 0, 16)); + btnRougeMax.setBounds(209, 405, 89, 23); + panelColor.add(btnRougeMax); + + btnRougeMini = new JButton("Rouge mini"); + btnRougeMini.setBackground(new Color(153, 0, 16)); + btnRougeMini.setBounds(30, 405, 89, 23); + panelColor.add(btnRougeMini); + + btnVertMini = new JButton("Vert mini"); + btnVertMini.setBackground(new Color(153, 0, 16)); + btnVertMini.setBounds(30, 430, 89, 23); + panelColor.add(btnVertMini); + + btnVertMax = new JButton("Vert max"); + btnVertMax.setBackground(new Color(153, 0, 16)); + btnVertMax.setBounds(209, 430, 89, 23); + panelColor.add(btnVertMax); + + btnBleuMini = new JButton("Bleu mini"); + btnBleuMini.setBackground(new Color(153, 0, 16)); + btnBleuMini.setBounds(30, 454, 89, 23); + panelColor.add(btnBleuMini); + + btnBleuMax = new JButton("Bleu max"); + btnBleuMax.setBackground(new Color(153, 0, 16)); + btnBleuMax.setBounds(209, 454, 89, 23); + panelColor.add(btnBleuMax); + + btnCouleurMiniTotal = new JButton("Couleur"); + btnCouleurMiniTotal.setBackground(Color.RED); + btnCouleurMiniTotal.setBounds(373, 430, 89, 23); + panelColor.add(btnCouleurMiniTotal); + + btnCouleurMaxiTotal = new JButton("Couleur"); + btnCouleurMaxiTotal.setBackground(Color.RED); + btnCouleurMaxiTotal.setBounds(519, 430, 89, 23); + panelColor.add(btnCouleurMaxiTotal); + + JLabel lblNewLabel_6 = new JLabel("Couleur la plus claire"); + lblNewLabel_6.setFont(new Font("Tahoma", Font.PLAIN, 11)); + lblNewLabel_6.setBounds(512, 409, 102, 14); + panelColor.add(lblNewLabel_6); + + JLabel lblNewLabel_6_1 = new JLabel("Couleur la plus sombre"); + lblNewLabel_6_1.setFont(new Font("Tahoma", Font.PLAIN, 11)); + lblNewLabel_6_1.setBounds(363, 409, 139, 14); + panelColor.add(lblNewLabel_6_1); + + //********************************************************* + //** TRADUCTION ** + //********************************************************* JPanel panelTraduction = new JPanel(); panelTraduction.setLayout(null); - tabbedPane.addTab("Traduction", img4, panelTraduction, null); + tabbedPane.addTab("Traduction", img6, panelTraduction, null); + + JLabel lblCouleur_1 = new JLabel("Dans le fichier d'analyse se trouve le node translation.
" + + "Cliquez sur le bouton extraire le node.
" + + "Vous pouvez manuellement ajouter des nodes enfants permettant la traduction des attributs d'analyseWriter.
" + + "Cliquez sur le bouton ajouter vos traductions pour insérer vos modifications." + + ""); + lblCouleur_1.setVerticalAlignment(SwingConstants.TOP); + lblCouleur_1.setHorizontalAlignment(SwingConstants.LEFT); + lblCouleur_1.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblCouleur_1.setBounds(10, 10, 691, 104); + panelTraduction.add(lblCouleur_1); + + btnExtraire = new JButton("Extraire le node"); + btnExtraire.setFont(new Font("Tahoma", Font.BOLD, 12)); + btnExtraire.setBounds(99, 201, 194, 48); + panelTraduction.add(btnExtraire); + + btnAjouterVosTraductions = new JButton("Ajouter vos traductions"); + btnAjouterVosTraductions.setFont(new Font("Tahoma", Font.BOLD, 12)); + btnAjouterVosTraductions.setBounds(388, 201, 205, 48); + panelTraduction.add(btnAjouterVosTraductions); + + + //********************************************************* + //** BOUTON VALIDATION MODIFICATION ** + //********************************************************* + btnValiderModifications = new JButton("Valider les modifications"); + btnValiderModifications.setFont(new Font("Tahoma", Font.BOLD, 14)); + JPanel Pane = new JPanel(); + Pane.setLayout(new GridLayout(1, 2, 0, 0)); + contentPane.add(Pane,BorderLayout.SOUTH ); + + btnReinit = new JButton("Réïnitialiser les valeurs"); + btnReinit.setFont(new Font("Tahoma", Font.BOLD, 14)); + Pane.add(btnReinit); + Pane.add(btnValiderModifications); + ListenerAction(); + + if(!erreurFormatHexCouleur()&&!erreurFormatHexCouleur()) miseAJourCouleurTest(); + this.setVisible(true); } @@ -200,28 +603,476 @@ public class setting extends JFrame { private void ListenerAction() { - btnValiderCSV.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - node nodCSV = commandes.sujet.retourneFirstEnfantsByName("csv"); - nodCSV.getAttributs().put("encoding", comboBoxEncodage.getSelectedItem().toString()); - if(comboBoxSeparateur.getSelectedItem().equals("point virgule")) nodCSV.getAttributs().put("separator", ";"); - if(comboBoxSeparateur.getSelectedItem().equals("virgule")) nodCSV.getAttributs().put("separator", ","); - if(comboBoxSeparateur.getSelectedItem().equals("espace")) nodCSV.getAttributs().put("separator", " "); - if(comboBoxSeparateur.getSelectedItem().equals("tabulation")) nodCSV.getAttributs().put("separator", "\t"); - - node nodImport= commandes.sujet.retourneFirstEnfantsByName("import_moodle"); - - nodImport.getAttributs().put("name", textFieldNomEtudiant.getText()); - nodImport.getAttributs().put("firstname", textFieldPrenomEtudiant.getText()); - nodImport.getAttributs().put("email", textFieldEmail.getText()); - nodImport.getAttributs().put("id", textFieldIDEtudiant.getText()); - - JOptionPane.showMessageDialog(null, "Les informations ont bien été renseignées.
" - + "N'oubliez pas d'enregistrer votre fichier d'analyse."); - } - }); + /** + * Bouton de validation des modification + */ + btnValiderModifications.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + if(!erreurValeursSaisies()&&!erreurToleranceCouleur()) { + //*** Validation du fichier CSV + node nodCSV = commandes.sujet.retourneFirstEnfantsByName("csv"); + nodCSV.getAttributs().put("encoding", comboBoxEncodage.getSelectedItem().toString()); + if(comboBoxSeparateur.getSelectedItem().equals("point virgule")) nodCSV.getAttributs().put("separator", ";"); + if(comboBoxSeparateur.getSelectedItem().equals("virgule")) nodCSV.getAttributs().put("separator", ","); + if(comboBoxSeparateur.getSelectedItem().equals("espace")) nodCSV.getAttributs().put("separator", " "); + if(comboBoxSeparateur.getSelectedItem().equals("tabulation")) nodCSV.getAttributs().put("separator", "\t"); + + node nodImport= commandes.sujet.retourneFirstEnfantsByName("import_moodle"); + + nodImport.getAttributs().put("name", textFieldNomEtudiant.getText()); + nodImport.getAttributs().put("firstname", textFieldPrenomEtudiant.getText()); + nodImport.getAttributs().put("email", textFieldEmail.getText()); + nodImport.getAttributs().put("id", textFieldIDEtudiant.getText()); + + //*** Validation du ZIP + node nodZIP = commandes.sujet.retourneFirstEnfantsByName("zip"); + int valueNumeric = Integer.valueOf(textFieldSize.getText()); + valueNumeric = valueNumeric*1000000; + valueNumeric = valueNumeric - 2000000; + nodZIP.getAttributs().put("size",String.valueOf(valueNumeric)); + nodZIP.getAttributs().put("nameZip",textFieldNameZIP.getText()); + + + //** Validation triche + node nodTriche = commandes.sujet.retourneFirstEnfantsByName("plagiarism"); + nodTriche.getAttributs().put("number_match",textFieldMiniCorrespondance.getText()); + nodTriche.getAttributs().put("mini_number_modification",textFieldNbrMiniModification.getText()); + nodTriche.getAttributs().put("nombres_modifications_simultané_maxi",textFieldMaxiModificationSimul.getText()); + + //** Validation similitude + node nodSimilitude = commandes.sujet.retourneFirstEnfantsByName("text:similarity"); + nodSimilitude.getAttributs().put("tolerance_text",textFieldTextSimilitude.getText()); + + //** Validation des tolérance couleur + node nodColor = commandes.sujet.retourneFirstEnfantsByName("color"); + nodColor.getAttributs().put("tolerance_rouge",textFieldRouge.getText()); + nodColor.getAttributs().put("tolerance_vert",textFieldVert.getText()); + nodColor.getAttributs().put("tolerance_bleu",textFieldBleu.getText()); + + JOptionPane.showMessageDialog(null, "Les informations ont bien été renseignées.
" + + "N'oubliez pas d'enregistrer votre fichier d'analyse."); + + } + + } + }); + /** + * Bouton du test de couleur + */ + btnTestCouleur.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if(!erreurFormatHexCouleur()&&!erreurFormatHexCouleur()) miseAJourCouleurTest(); + } + }); + + /** + * Bouton extraire le node translate + */ + btnExtraire.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + node nodeTransalte = commandes.sujet.retourneFirstEnfantsByName("translation"); + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setDialogTitle("Enregistrer sous..."); + File file = null; + + fileChooser.setCurrentDirectory(file); + + int userSelection = fileChooser.showSaveDialog(null); + + if (userSelection == JFileChooser.APPROVE_OPTION) { + File fileToSave = fileChooser.getSelectedFile(); + try { + + Run.ecritureNodeEnXML(nodeTransalte, fileToSave.getName(), fileToSave.getPath().substring(0,fileToSave.getPath().lastIndexOf("\\")),"" ); + JOptionPane.showMessageDialog(null, "Le fichier \"" + fileToSave.getName() + ".xml\" a été renregistré.\n\nIl se trouve dans le dossier " + fileToSave.getPath()); + + } catch (IOException e1) { + e1.printStackTrace(); + } + + } + } + }); + + /** + * Ajoute les traductions personnalisées + */ + btnAjouterVosTraductions.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setDialogTitle("Charger le node translate en mémoire"); + + FileNameExtensionFilter filter = new FileNameExtensionFilter("Fichier d'analyse .XML", "xml"); + fileChooser.setFileFilter(filter); + File file = null; + + fileChooser.setCurrentDirectory(file); + + int userSelection = fileChooser.showSaveDialog(null); + + if (userSelection == JFileChooser.APPROVE_OPTION) { + File fileToSave = fileChooser.getSelectedFile(); + try { + file = new File(fileToSave.getAbsolutePath()); + BufferedReader br = new BufferedReader( + new InputStreamReader( + new FileInputStream(file.getAbsoluteFile()), "UTF-8")); + String line; + StringBuilder targetString = new StringBuilder(); + while ((line = br.readLine()) != null) { + targetString.append(line); + } + node nodeSetting = commandes.sujet.retourneFirstEnfantsByName("setting"); + node nodeTranslate2 = Run.XMLContent(targetString.toString()); + if(nodeTranslate2.getNomElt().equals("translation")) { + nodeSetting.getNodes().remove(commandes.sujet.retourneFirstEnfantsByName("translation")); + nodeSetting.getNodes().add(nodeTranslate2); + JOptionPane.showMessageDialog(null, "Chargement du nouveau node de traduction."); + } + + }catch (Exception e1) { + + } + } + } + }); + + /** + * Réînitialiser les valeurs par défaut + */ + btnReinit.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + int a = JOptionPane.showConfirmDialog(null,"Voulez-vous remettre toutes les valeurs par défauts?", "Sélectionner un choix", JOptionPane.YES_NO_OPTION); + + if(a == JOptionPane.YES_NO_OPTION) { + node nodCSV = commandes.sujet.retourneFirstEnfantsByName("csv"); + nodCSV.getAttributs().put("encoding","UTF-8"); + nodCSV.getAttributs().put("separator",";"); + node nodImportMoodle = nodCSV.retourneFirstEnfantsByName("import_moodle"); + nodImportMoodle.getAttributs().put("name","nom"); + nodImportMoodle.getAttributs().put("email","adresse"); + nodImportMoodle.getAttributs().put("firstname","prenom"); + nodImportMoodle.getAttributs().put("id","identification"); + node nodZIP = commandes.sujet.retourneFirstEnfantsByName("zip"); + nodZIP.getAttributs().put("size","48000000"); + nodZIP.getAttributs().put("nameZip","feedbackMoodle"); + node nodplagiarism = commandes.sujet.retourneFirstEnfantsByName("plagiarism"); + nodplagiarism.getAttributs().put("number_match","2"); + nodplagiarism.getAttributs().put("mini_number_modification","-1"); + nodplagiarism.getAttributs().put("nombres_modifications_simultané_maxi","100"); + node nodSimilitude = commandes.sujet.retourneFirstEnfantsByName("text:similarity"); + nodSimilitude.getAttributs().put("tolerance_text","0.79"); + node nodColor = commandes.sujet.retourneFirstEnfantsByName("color"); + nodColor.getAttributs().put("tolerance_rouge","30"); + nodColor.getAttributs().put("tolerance_vert","30"); + nodColor.getAttributs().put("tolerance_bleu","30"); + + // Relecture des nouvelles valeurs + comboBoxEncodage.setSelectedItem(nodCSV.getAttributs().get("encoding")); + if(nodCSV.getAttributs().get("separator").equals(";")) comboBoxSeparateur.setSelectedItem("point virgule"); + if(nodCSV.getAttributs().get("separator").equals(",")) comboBoxSeparateur.setSelectedItem("virgule"); + if(nodCSV.getAttributs().get("separator").equals(" ")) comboBoxSeparateur.setSelectedItem("espace"); + if(nodCSV.getAttributs().get("separator").equals("\t")) comboBoxSeparateur.setSelectedItem("tabulation"); + textFieldNomEtudiant.setText(nodImportMoodle.getAttributs().get("name")); + textFieldPrenomEtudiant.setText(nodImportMoodle.getAttributs().get("firstname")); + textFieldEmail.setText(nodImportMoodle.getAttributs().get("email")); + textFieldIDEtudiant.setText(nodImportMoodle.getAttributs().get("id")); + textFieldSize.setText(nodZIP.getAttributs().get("size")); + textFieldNameZIP.setText(nodZIP.getAttributs().get("nameZip")); + textFieldMiniCorrespondance.setText(nodplagiarism.getAttributs().get("number_match")); + textFieldNbrMiniModification.setText(nodplagiarism.getAttributs().get("mini_number_modification")); + textFieldMaxiModificationSimul.setText(nodplagiarism.getAttributs().get("nombres_modifications_simultané_maxi")); + textFieldTextSimilitude.setText(nodSimilitude.getAttributs().get("tolerance_text")); + textFieldRouge.setText(nodColor.getAttributs().get("tolerance_rouge")); + textFieldVert.setText(nodColor.getAttributs().get("tolerance_vert")); + textFieldBleu.setText(nodColor.getAttributs().get("tolerance_bleu")); + } + } + }); } - + /** + * vérification des valeurs saisies dans la fenêtre setting. + * @return + */ + private boolean erreurValeursSaisies() { + boolean erreur = false; + + //******************* + //** taille du zip ** + //******************* + Integer valueNumeric = 0; + try { + valueNumeric = Integer.valueOf(textFieldSize.getText()); + if(valueNumeric<2) { + JOptionPane.showInternalMessageDialog(null, "La taille de l'archive doit être supérieure à 2 Mo."); + erreur = true; + } + if(valueNumeric>200) { + JOptionPane.showInternalMessageDialog(null, "La taille de l'archive doit être inférieure à 200 Mo."); + erreur = true; + } + }catch (Exception e1) { + JOptionPane.showInternalMessageDialog(null, "Il y a un problème avec le format de la taille de l'archive."); + erreur = true; + } + + //****************************** + //** Les valeurs de la triche ** + //****************************** + try { + valueNumeric = Integer.valueOf(textFieldMiniCorrespondance.getText()); + if(valueNumeric<1) { + JOptionPane.showInternalMessageDialog(null, "Le nombre de correspondance doit être supérieure à 1."); + erreur = true; + } + if(valueNumeric>5) { + JOptionPane.showInternalMessageDialog(null, "Le nombre de correspondance doit être inférieure à 5."); + erreur = true; + } + }catch (Exception e1) { + JOptionPane.showInternalMessageDialog(null, "Il y a un problème avec le format du nombre de correspondance (triche)."); + erreur = true; + } + try { + valueNumeric = Integer.valueOf(textFieldNbrMiniModification.getText()); + if(valueNumeric<-2) { + JOptionPane.showInternalMessageDialog(null, "Le nombre minimal de modification dans le fichier doit être supérieure à -1."); + erreur = true; + } + }catch (Exception e1) { + JOptionPane.showInternalMessageDialog(null, "Il y a un problème avec le format du nombre de modification minimale (triche)."); + erreur = true; + } + try { + valueNumeric = Integer.valueOf(textFieldMaxiModificationSimul.getText()); + if(valueNumeric<0) { + JOptionPane.showInternalMessageDialog(null, "Le nombre maximal de modification dans le fichier doit être une valeur positive non nulle."); + erreur = true; + } + }catch (Exception e1) { + JOptionPane.showInternalMessageDialog(null, "Il y a un problème avec le format du nombre de modification maximale (triche)."); + erreur = true; + } + + //********************************** + //** Les valeurs de la similitude ** + //********************************** + try { + double valueNumericDouble = Double.valueOf(textFieldTextSimilitude.getText()); + if(valueNumericDouble<0) { + JOptionPane.showInternalMessageDialog(null, "La distance de Levenshtein doit être supérieure à 0."); + erreur = true; + } + if(valueNumericDouble>1) { + JOptionPane.showInternalMessageDialog(null, "La distance de Levenshtein doit être inférieure à 1."); + erreur = true; + } + }catch (Exception e1) { + JOptionPane.showInternalMessageDialog(null, "Il y a un problème avec le format de la distance de Levenshtein."); + erreur = true; + } + + + + + //*************************************************** + //** caractères spéciaux dans les noms des valeurs ** + //*************************************************** + Pattern p = Pattern.compile("[^\\w]"); + Matcher m = p.matcher(textFieldNomEtudiant.getText()); + if(m.find()) { + JOptionPane.showInternalMessageDialog(null, "Il y a un caractère spécial dans le nom du champ, nom de l'étudiant (fichier CSV)."); + erreur = true; + } + m = p.matcher(textFieldPrenomEtudiant.getText()); + if(m.find()) { + JOptionPane.showInternalMessageDialog(null, "Il y a un caractère spécial dans le nom du champ, prénom de l'étudiant (fichier CSV)."); + erreur = true; + } + m = p.matcher(textFieldPrenomEtudiant.getText()); + if(m.find()) { + JOptionPane.showInternalMessageDialog(null, "Il y a un caractère spécial dans le nom du champ, prénom de l'étudiant (fichier CSV)."); + erreur = true; + } + m = p.matcher(textFieldEmail.getText()); + if(m.find()) { + JOptionPane.showInternalMessageDialog(null, "Il y a un caractère spécial dans le nom du champ, email de l'étudiant (fichier CSV)."); + erreur = true; + } + m = p.matcher(textFieldIDEtudiant.getText()); + if(m.find()) { + JOptionPane.showInternalMessageDialog(null, "Il y a un caractère spécial dans le nom du champ, numéro de l'étudiant (fichier CSV)."); + erreur = true; + } + m = p.matcher(textFieldNameZIP.getText()); + if(m.find()) { + JOptionPane.showInternalMessageDialog(null, "Il y a un caractère spécial dans le nom de l'archive."); + erreur = true; + } + + + + return erreur; + } + + + /** + * Vérification du format du code couleur pour le test de couleur. + * @return + */ + private boolean erreurFormatHexCouleur() { + boolean erreur= false; + Pattern p = Pattern.compile("^#[a-fA-F0-9].{6}$"); + Matcher m = p.matcher(textFieldTestCouleur.getText().toUpperCase()); + if(m.find()) { + JOptionPane.showInternalMessageDialog(null, "Ce n'est pas le format correct d'un code couleur hexdécimal."); + erreur = true; + } + return erreur; + } + + /** + * Vérification tolérance de couleur. + * @return + */ + private boolean erreurToleranceCouleur() { + boolean erreur =false; + + Integer valueNumeric = 0; + try { + valueNumeric = Integer.valueOf(textFieldRouge.getText()); + if(valueNumeric<0) { + JOptionPane.showInternalMessageDialog(null, "La tolérance sur le rouge doit être une valeur positive."); + erreur = true; + } + if(valueNumeric>255) { + JOptionPane.showInternalMessageDialog(null, "La tolérance sur le rouge doit être inférieur à 255."); + erreur = true; + } + }catch (Exception e1) { + JOptionPane.showInternalMessageDialog(null, "Il y a un problème avec le format de la tolérance sur le rouge."); + erreur = true; + } + + try { + valueNumeric = Integer.valueOf(textFieldVert.getText()); + if(valueNumeric<0) { + JOptionPane.showInternalMessageDialog(null, "La tolérance sur le vert doit être une valeur positive."); + erreur = true; + } + if(valueNumeric>255) { + JOptionPane.showInternalMessageDialog(null, "La tolérance sur le vert doit être inférieur à 255."); + erreur = true; + } + }catch (Exception e1) { + JOptionPane.showInternalMessageDialog(null, "Il y a un problème avec le format de la tolérance sur le vert."); + erreur = true; + } + + try { + valueNumeric = Integer.valueOf(textFieldBleu.getText()); + if(valueNumeric<0) { + JOptionPane.showInternalMessageDialog(null, "La tolérance sur le bleu doit être une valeur positive."); + erreur = true; + } + if(valueNumeric>255) { + JOptionPane.showInternalMessageDialog(null, "La tolérance sur le bleu doit être inférieur à 255."); + erreur = true; + } + }catch (Exception e1) { + JOptionPane.showInternalMessageDialog(null, "Il y a un problème avec le format de la tolérance sur le bleu."); + erreur = true; + } + + + return erreur; + } + + + /** + * + * @param colorStr + * @return + */ + public static Color hex2Rgb(String colorStr) { + return new Color( + Integer.valueOf( colorStr.substring( 1, 3 ), 16 ), + Integer.valueOf( colorStr.substring( 3, 5 ), 16 ), + Integer.valueOf( colorStr.substring( 5, 7 ), 16 ) ); + } + + /** + * + * @param couleur + * @return + */ + public static String Rgb2hex(Color couleur) { + return String.format("#%02x%02x%02x", couleur.getRed(), couleur.getGreen(), couleur.getBlue()); + } + + /** + * Mise à jour du test de couleur + */ + private void miseAJourCouleurTest() { + if(!erreurFormatHexCouleur()&&!erreurToleranceCouleur()) { + Color couleurInit = hex2Rgb(textFieldTestCouleur.getText()); + btnCouleurInitTest.setBackground(couleurInit); + btnCouleurInitTest.setText(textFieldTestCouleur.getText()); + + int couleurMaxRouge = couleurInit.getRed()+ Integer.valueOf(textFieldRouge.getText()); + if(couleurMaxRouge>255) couleurMaxRouge=255; + Color couleurRougeMaxi = new Color(couleurMaxRouge, couleurInit.getGreen(), couleurInit.getBlue()); + btnRougeMax.setBackground(couleurRougeMaxi); + btnRougeMax.setText(Rgb2hex(couleurRougeMaxi)); + + int couleurMiniRouge = couleurInit.getRed()- Integer.valueOf(textFieldRouge.getText()); + if(couleurMiniRouge<0) couleurMiniRouge=0; + Color couleurRougeMini = new Color(couleurMiniRouge, couleurInit.getGreen(), couleurInit.getBlue()); + btnRougeMini.setBackground(couleurRougeMini); + btnRougeMini.setText(Rgb2hex(couleurRougeMini)); + + int couleurMaxVert = couleurInit.getGreen()+ Integer.valueOf(textFieldVert.getText()); + if(couleurMaxVert>255) couleurMaxVert=255; + Color couleurVertMaxi = new Color(couleurInit.getRed(), couleurMaxVert, couleurInit.getBlue()); + btnVertMax.setBackground(couleurVertMaxi); + btnVertMax.setText(Rgb2hex(couleurVertMaxi)); + + int couleurMiniVert = couleurInit.getGreen()- Integer.valueOf(textFieldVert.getText()); + if(couleurMiniVert<0) couleurMiniVert=0; + Color couleurVertMini = new Color(couleurInit.getRed(), couleurMiniVert, couleurInit.getBlue()); + btnVertMini.setBackground(couleurVertMini); + btnVertMini.setText(Rgb2hex(couleurVertMini)); + + int couleurMaxBleu = couleurInit.getBlue()+ Integer.valueOf(textFieldBleu.getText()); + if(couleurMaxBleu>255) couleurMaxBleu=255; + Color couleurBleuMaxi = new Color(couleurInit.getRed(), couleurInit.getGreen(), couleurMaxBleu); + btnBleuMax.setBackground(couleurBleuMaxi); + btnBleuMax.setText(Rgb2hex(couleurBleuMaxi)); + + int couleurMiniBleu = couleurInit.getBlue()- Integer.valueOf(textFieldBleu.getText()); + if(couleurMiniBleu<0) couleurMiniBleu=0; + Color couleurBleuMini = new Color(couleurInit.getRed(), couleurInit.getGreen(), couleurMiniBleu); + btnBleuMini.setBackground(couleurBleuMini); + btnBleuMini.setText(Rgb2hex(couleurBleuMini)); + + Color couleurMaxi = new Color(couleurMaxRouge, couleurMaxVert, couleurMaxBleu); + btnCouleurMaxiTotal.setBackground(couleurMaxi); + btnCouleurMaxiTotal.setText(Rgb2hex(couleurMaxi)); + + Color couleurMini= new Color(couleurMiniRouge, couleurMiniVert, couleurMiniBleu); + btnCouleurMiniTotal.setBackground(couleurMini); + btnCouleurMiniTotal.setText(Rgb2hex(couleurMini)); + + + } + } + + + } + + + diff --git a/src/resources/couleur.png b/src/resources/couleur.png new file mode 100644 index 0000000..6762b3d Binary files /dev/null and b/src/resources/couleur.png differ diff --git a/src/resources/couleurmini.png b/src/resources/couleurmini.png new file mode 100644 index 0000000..5e82950 Binary files /dev/null and b/src/resources/couleurmini.png differ diff --git a/src/resources/similitude.png b/src/resources/similitude.png new file mode 100644 index 0000000..6b2887e Binary files /dev/null and b/src/resources/similitude.png differ diff --git a/src/resources/similitudemini.png b/src/resources/similitudemini.png new file mode 100644 index 0000000..89e7c70 Binary files /dev/null and b/src/resources/similitudemini.png differ diff --git a/src/resources/traduction.png b/src/resources/traduction.png new file mode 100644 index 0000000..e58237e Binary files /dev/null and b/src/resources/traduction.png differ diff --git a/src/resources/traductionmini.png b/src/resources/traductionmini.png new file mode 100644 index 0000000..d9a0805 Binary files /dev/null and b/src/resources/traductionmini.png differ diff --git a/src/resources/triche.png b/src/resources/triche.png new file mode 100644 index 0000000..f649dca Binary files /dev/null and b/src/resources/triche.png differ diff --git a/src/resources/trichemini.png b/src/resources/trichemini.png new file mode 100644 index 0000000..4ff1d60 Binary files /dev/null and b/src/resources/trichemini.png differ diff --git a/src/resources/zip.png b/src/resources/zip.png new file mode 100644 index 0000000..a196233 Binary files /dev/null and b/src/resources/zip.png differ diff --git a/src/resources/zipmini.png b/src/resources/zipmini.png new file mode 100644 index 0000000..516c7ab Binary files /dev/null and b/src/resources/zipmini.png differ