2022-06-19 21:01:30 +02:00
package fenetres ;
2022-05-24 18:25:41 +02:00
import java.awt.BorderLayout ;
2022-05-25 09:30:49 +02:00
import java.awt.Font ;
import java.awt.event.ActionEvent ;
2022-05-28 19:13:25 +02:00
import java.awt.event.KeyEvent ;
2022-05-25 09:30:49 +02:00
import java.io.IOException ;
2022-05-31 19:37:46 +02:00
2022-05-24 18:25:41 +02:00
2022-05-28 19:13:25 +02:00
import javax.swing.AbstractAction ;
import javax.swing.Action ;
2022-05-25 09:30:49 +02:00
import javax.swing.ImageIcon ;
import javax.swing.JButton ;
import javax.swing.JCheckBox ;
import javax.swing.JFileChooser ;
2022-05-24 18:25:41 +02:00
import javax.swing.JFrame ;
2022-05-25 09:30:49 +02:00
import javax.swing.JLabel ;
2022-05-24 18:25:41 +02:00
import javax.swing.JPanel ;
2022-05-25 09:30:49 +02:00
import javax.swing.JToolBar ;
2022-05-28 19:13:25 +02:00
import javax.swing.KeyStroke ;
2022-05-24 18:25:41 +02:00
import javax.swing.border.EmptyBorder ;
2022-05-25 21:22:38 +02:00
import javax.swing.filechooser.FileNameExtensionFilter ;
2022-05-24 18:25:41 +02:00
import javax.xml.parsers.ParserConfigurationException ;
import org.xml.sax.SAXException ;
import MEPTL.commandes ;
import MEPTL.meptl ;
2022-05-27 11:40:08 +02:00
import cXML.Run ;
import cXML.node ;
2022-06-19 21:01:30 +02:00
import fenetres.create_act.actAbout ;
2022-05-27 11:40:08 +02:00
2022-05-25 15:28:58 +02:00
import javax.swing.SwingConstants ;
import javax.swing.JScrollPane ;
2022-05-26 20:10:24 +02:00
import net.miginfocom.swing.MigLayout ;
2022-05-28 19:13:25 +02:00
import java.awt.event.InputEvent ;
import javax.swing.JMenuBar ;
import javax.swing.JMenu ;
import javax.swing.JOptionPane ;
import java.awt.Color ;
2022-06-03 21:30:14 +02:00
2022-06-09 17:49:22 +02:00
import javax.swing.event.ChangeListener ;
import javax.swing.event.ChangeEvent ;
2022-11-13 11:57:18 +01:00
import java.awt.event.ActionListener ;
2022-06-03 21:30:14 +02:00
2022-05-24 18:25:41 +02:00
2022-06-19 21:01:30 +02:00
2022-05-24 18:25:41 +02:00
public class evaluate extends JFrame {
2022-05-31 19:37:46 +02:00
/ * *
*
* /
private static final long serialVersionUID = 1L ;
2022-06-03 21:30:14 +02:00
2022-05-24 18:25:41 +02:00
/ * *
*
* /
2022-06-03 21:30:14 +02:00
private JToolBar toolBar ;
2022-05-28 19:13:25 +02:00
private JPanel contentPane ;
2022-06-03 21:30:14 +02:00
private JLabel lblPath ;
private JLabel lblFileAnalyse ;
private JLabel lblFichierCSV ;
private JLabel lblFichierSVG ;
2022-11-22 10:58:30 +01:00
private JLabel lblChargementFichierCSV ;
2022-11-13 11:57:18 +01:00
private JCheckBox chckbxfichiersEtudiants ;
2022-06-03 21:30:14 +02:00
private JCheckBox chckbxZipfeedback ;
private JCheckBox chckbxnoFeedback ;
private JCheckBox chckbxNoNote ;
private JCheckBox chckCSVNotes ;
private JCheckBox chckbxNoLogo ;
private JCheckBox chckbxVerif ;
private JCheckBox chckbxNewLogo ;
2022-06-11 12:10:28 +02:00
private afficheText txtpnmessages ;
2022-06-04 15:43:08 +02:00
2022-05-28 19:13:25 +02:00
2022-05-25 18:21:23 +02:00
2022-05-24 18:25:41 +02:00
/ * *
* Create the frame .
* /
public evaluate ( ) {
2022-05-26 20:10:24 +02:00
ImageIcon img = new ImageIcon ( getClass ( ) . getResource ( " /evalwriter.png " ) ) ;
this . setIconImage ( img . getImage ( ) ) ;
2022-06-06 18:59:42 +02:00
setTitle ( commandes . Titre + " " + commandes . version + " " + commandes . branch ) ;
2022-05-24 18:25:41 +02:00
2022-06-15 08:03:17 +02:00
setDefaultCloseOperation ( JFrame . DO_NOTHING_ON_CLOSE ) ;
2022-05-28 19:13:25 +02:00
setBounds ( 100 , 100 , 980 , 700 ) ;
2022-06-09 09:13:46 +02:00
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 ) ;
2022-05-27 11:40:08 +02:00
2022-06-03 21:30:14 +02:00
createMenu ( ) ;
createToolBar ( ) ;
2022-05-27 11:40:08 +02:00
2022-05-28 19:13:25 +02:00
contentPane = new JPanel ( ) ;
contentPane . setBorder ( new EmptyBorder ( 5 , 5 , 5 , 5 ) ) ;
setContentPane ( contentPane ) ;
contentPane . setLayout ( new BorderLayout ( 0 , 0 ) ) ;
2022-05-27 11:40:08 +02:00
2022-06-03 21:30:14 +02:00
contentPane . add ( toolBar , BorderLayout . NORTH ) ;
JPanel panelWest = new JPanel ( ) ;
contentPane . add ( panelWest , BorderLayout . WEST ) ;
2022-11-22 10:58:30 +01:00
panelWest . setLayout ( new MigLayout ( " " , " [309px][] " , " [38.00][71px][71px][][][71px][][74.00][][] " ) ) ;
2022-05-28 19:13:25 +02:00
JLabel lblTITRE = new JLabel ( " <HTML><U>PARAMETRES</U></HTML> " ) ;
lblTITRE . setForeground ( Color . RED ) ;
lblTITRE . setFont ( new Font ( " Tahoma " , Font . BOLD , 16 ) ) ;
lblTITRE . setHorizontalAlignment ( SwingConstants . CENTER ) ;
2022-06-03 21:30:14 +02:00
panelWest . add ( lblTITRE , " cell 0 0,alignx left,aligny center " ) ;
2022-05-25 15:28:58 +02:00
lblFileAnalyse = new JLabel ( " <HTML><B><U>Fichier de l'analyse</U></B> : </HTML> " ) ;
lblFileAnalyse . setHorizontalAlignment ( SwingConstants . LEFT ) ;
2022-05-25 21:22:38 +02:00
lblFileAnalyse . setFont ( new Font ( " Tahoma " , Font . BOLD , 14 ) ) ;
2022-06-03 21:30:14 +02:00
panelWest . add ( lblFileAnalyse , " flowy,cell 0 1,alignx left,growy " ) ;
2022-05-25 21:22:38 +02:00
2022-11-13 11:57:18 +01:00
chckbxfichiersEtudiants = new JCheckBox ( " Les fichiers ne sont pas dans des dossiers nominatifs " ) ;
chckbxfichiersEtudiants . addChangeListener ( new ChangeListener ( ) {
2022-06-09 17:49:22 +02:00
public void stateChanged ( ChangeEvent e ) {
2022-11-13 11:57:18 +01:00
if ( chckbxfichiersEtudiants . isSelected ( ) ) {
2022-06-09 17:49:22 +02:00
commandes . fichierStudentMoodle = true ;
} else {
commandes . fichierStudentMoodle = false ;
}
}
} ) ;
2022-11-13 11:57:18 +01:00
chckbxfichiersEtudiants . setFont ( new Font ( " Tahoma " , Font . PLAIN , 12 ) ) ;
chckbxfichiersEtudiants . setToolTipText ( " Cochez si les fichiers des étudiants ne sont pas dans des dossier nominatifs " ) ;
panelWest . add ( chckbxfichiersEtudiants , " flowy,cell 0 2,grow " ) ;
2022-05-26 20:10:24 +02:00
2022-11-22 10:58:30 +01:00
lblChargementFichierCSV = new JLabel ( " Chargement de la liste des étudiants " ) ;
panelWest . add ( lblChargementFichierCSV , " cell 0 3,alignx left,aligny center " ) ;
2022-05-26 20:10:24 +02:00
lblFichierCSV = new JLabel ( " <HTML><B><U>Fichier CSV liste des étudiants</U></B></HTML> : " ) ;
lblFichierCSV . setFont ( new Font ( " Tahoma " , Font . BOLD , 14 ) ) ;
2022-11-22 10:58:30 +01:00
panelWest . add ( lblFichierCSV , " flowy,cell 0 5,grow " ) ;
2022-05-26 20:10:24 +02:00
lblFichierSVG = new JLabel ( " <HTML><B><U>Fichier SVG</U></B> :</HTML> " ) ;
lblFichierSVG . setFont ( new Font ( " Tahoma " , Font . BOLD , 14 ) ) ;
2022-11-22 10:58:30 +01:00
panelWest . add ( lblFichierSVG , " flowy,cell 0 7,growx " ) ;
2022-05-26 20:10:24 +02:00
chckCSVNotes = new JCheckBox ( " Créer un fichier CSV des notes " ) ;
2022-06-09 17:49:22 +02:00
chckCSVNotes . addChangeListener ( new ChangeListener ( ) {
public void stateChanged ( ChangeEvent e ) {
if ( chckCSVNotes . isSelected ( ) ) {
commandes . ecritNoteCSV = true ;
} else {
commandes . ecritNoteCSV = false ;
}
}
} ) ;
2022-05-27 11:40:08 +02:00
chckCSVNotes . setToolTipText ( " Cochez si vous voulez importer les notes dans un fichier CSV. " ) ;
2022-11-22 10:58:30 +01:00
panelWest . add ( chckCSVNotes , " cell 0 5,grow " ) ;
2022-06-03 21:30:14 +02:00
lblPath = new JLabel ( ) ;
2022-05-26 20:10:24 +02:00
lblPath . setHorizontalAlignment ( SwingConstants . LEFT ) ;
lblPath . setFont ( new Font ( " Tahoma " , Font . BOLD , 14 ) ) ;
lblPath . setText ( " <HTML><B><U>Dossier de l'analyse</U></B> : " + commandes . path . substring ( commandes . path . lastIndexOf ( " \\ " ) + 1 , commandes . path . length ( ) ) + " </HTML> " ) ;
2022-06-03 21:30:14 +02:00
panelWest . add ( lblPath , " cell 0 1,grow " ) ;
2022-05-24 18:25:41 +02:00
chckbxnoFeedback = new JCheckBox ( " Pas de feedback " ) ;
2022-06-09 17:49:22 +02:00
chckbxnoFeedback . addChangeListener ( new ChangeListener ( ) {
public void stateChanged ( ChangeEvent e ) {
if ( chckbxnoFeedback . isSelected ( ) ) {
commandes . sansFeeback = true ;
} else {
commandes . sansFeeback = false ;
}
}
} ) ;
2022-05-27 11:40:08 +02:00
chckbxnoFeedback . setToolTipText ( " Cochez si vous ne voulez pas générer des feedbacks " ) ;
2022-05-24 18:25:41 +02:00
chckbxnoFeedback . setFont ( new Font ( " Tahoma " , Font . PLAIN , 12 ) ) ;
2022-06-03 21:30:14 +02:00
panelWest . add ( chckbxnoFeedback , " cell 0 2,grow " ) ;
2022-05-24 18:25:41 +02:00
chckbxZipfeedback = new JCheckBox ( " Zip les feedbacks " ) ;
2022-06-09 17:49:22 +02:00
chckbxZipfeedback . addChangeListener ( new ChangeListener ( ) {
public void stateChanged ( ChangeEvent e ) {
if ( chckbxZipfeedback . isSelected ( ) ) {
commandes . zipfeedback = true ;
} else {
commandes . zipfeedback = false ;
}
}
} ) ;
2022-05-27 11:40:08 +02:00
chckbxZipfeedback . setToolTipText ( " Cochez si vous voulez placer tous les feedbacks dans une archive ZIP " ) ;
2022-05-24 18:25:41 +02:00
chckbxZipfeedback . setFont ( new Font ( " Tahoma " , Font . PLAIN , 12 ) ) ;
2022-06-03 21:30:14 +02:00
panelWest . add ( chckbxZipfeedback , " cell 0 2,grow " ) ;
2022-05-24 18:25:41 +02:00
chckbxNoNote = new JCheckBox ( " Pas de note dans les feedbacks " ) ;
2022-06-09 17:49:22 +02:00
chckbxNoNote . addChangeListener ( new ChangeListener ( ) {
public void stateChanged ( ChangeEvent e ) {
if ( chckbxNoNote . isSelected ( ) ) {
commandes . noNote = true ;
} else {
commandes . noNote = false ;
}
}
} ) ;
2022-05-27 11:40:08 +02:00
chckbxNoNote . setToolTipText ( " Cochez si vous voulez pas faire apparaître les notes dans les feedbacks " ) ;
2022-05-24 18:25:41 +02:00
chckbxNoNote . setFont ( new Font ( " Tahoma " , Font . PLAIN , 12 ) ) ;
2022-06-03 21:30:14 +02:00
panelWest . add ( chckbxNoNote , " cell 0 2,grow " ) ;
2022-05-25 18:21:23 +02:00
2022-05-27 11:40:08 +02:00
chckbxVerif = new JCheckBox ( " Vérification des historiques avant analyse " ) ;
2022-06-09 17:49:22 +02:00
chckbxVerif . addChangeListener ( new ChangeListener ( ) {
public void stateChanged ( ChangeEvent e ) {
if ( chckbxVerif . isSelected ( ) ) {
commandes . verifHisto2 = true ;
} else {
commandes . verifHisto2 = false ;
}
}
} ) ;
2022-05-27 11:40:08 +02:00
chckbxVerif . setToolTipText ( " Cochez si vous voulez vérifier les échanges de fichiers entre les étudiants. " ) ;
chckbxVerif . setFont ( new Font ( " Tahoma " , Font . PLAIN , 12 ) ) ;
2022-06-03 21:30:14 +02:00
panelWest . add ( chckbxVerif , " cell 0 2,grow " ) ;
2022-05-27 11:40:08 +02:00
2022-05-26 20:10:24 +02:00
chckbxNewLogo = new JCheckBox ( " Nouveau logo " ) ;
2022-06-09 17:49:22 +02:00
chckbxNewLogo . addChangeListener ( new ChangeListener ( ) {
public void stateChanged ( ChangeEvent e ) {
if ( chckbxNewLogo . isSelected ( ) ) {
commandes . newLogo = true ;
} else {
commandes . newLogo = false ;
}
}
} ) ;
2022-05-27 11:40:08 +02:00
chckbxNewLogo . setToolTipText ( " Cochez si vous voulez remplacer le logo par celui au-dessus. " ) ;
chckbxNewLogo . setFont ( new Font ( " Tahoma " , Font . PLAIN , 12 ) ) ;
2022-11-22 10:58:30 +01:00
panelWest . add ( chckbxNewLogo , " cell 0 7 " ) ;
2022-05-26 20:10:24 +02:00
chckbxNoLogo = new JCheckBox ( " Pas de logo " ) ;
2022-06-09 17:49:22 +02:00
chckbxNoLogo . addChangeListener ( new ChangeListener ( ) {
public void stateChanged ( ChangeEvent e ) {
if ( chckbxNoLogo . isSelected ( ) ) {
commandes . noLogo = true ;
} else {
commandes . noLogo = false ;
}
}
} ) ;
2022-05-27 11:40:08 +02:00
chckbxNoLogo . setToolTipText ( " Cochez si vous voulez pas de logo dans les feedbacks. " ) ;
chckbxNoLogo . setFont ( new Font ( " Tahoma " , Font . PLAIN , 12 ) ) ;
2022-11-22 10:58:30 +01:00
panelWest . add ( chckbxNoLogo , " cell 0 7 " ) ;
2022-05-24 18:25:41 +02:00
2022-06-03 21:30:14 +02:00
JPanel panelCentre = new JPanel ( ) ;
contentPane . add ( panelCentre , BorderLayout . CENTER ) ;
panelCentre . setLayout ( new BorderLayout ( 0 , 0 ) ) ;
2022-05-24 18:25:41 +02:00
2022-05-25 15:28:58 +02:00
JScrollPane scrollPane = new JScrollPane ( ) ;
2022-06-03 21:30:14 +02:00
panelCentre . add ( scrollPane ) ;
2022-05-25 15:28:58 +02:00
2022-05-24 18:25:41 +02:00
2022-06-11 12:10:28 +02:00
txtpnmessages = new afficheText ( ) ;
2022-06-09 09:13:46 +02:00
txtpnmessages . setFont ( new Font ( " Tahoma " , Font . PLAIN , 16 ) ) ;
2022-06-11 12:10:28 +02:00
txtpnmessages . setContentType ( " text/html " ) ;
txtpnmessages . setText ( baliseStyle . balise ( ) + " <hr><h1 class \" city \" >*** Charger un fichier d'analyse. ***</h1><hr> " ) ;
2022-05-25 18:21:23 +02:00
scrollPane . setViewportView ( txtpnmessages ) ;
2022-05-24 18:25:41 +02:00
2022-05-31 19:37:46 +02:00
this . setExtendedState ( MAXIMIZED_BOTH ) ;
2022-05-28 19:13:25 +02:00
2022-06-15 08:03:17 +02:00
ListenerAction ( ) ;
2022-05-24 18:25:41 +02:00
refreshLabel ( ) ;
setVisible ( true ) ;
2022-06-03 21:30:14 +02:00
// Pro();
}
2022-06-04 15:43:08 +02:00
2022-06-15 08:03:17 +02:00
private void ListenerAction ( ) {
/*Some piece of code*/
addWindowListener ( new java . awt . event . WindowAdapter ( ) {
@Override
public void windowClosing ( java . awt . event . WindowEvent windowEvent ) {
if ( JOptionPane . showConfirmDialog ( null , " Voulez-vous quitter analyseWriter? " , " Quitter " , JOptionPane . YES_NO_OPTION , JOptionPane . QUESTION_MESSAGE ) = = JOptionPane . YES_OPTION ) {
dispose ( ) ;
}
}
} ) ;
}
2022-06-03 21:30:14 +02:00
private void createMenu ( ) {
JMenuBar menuBar = new JMenuBar ( ) ;
menuBar . setFont ( new Font ( " Segoe UI " , Font . BOLD , 14 ) ) ;
setJMenuBar ( menuBar ) ;
JMenu mnNewMenu = new JMenu ( " Fichier " ) ;
mnNewMenu . setMnemonic ( 'F' ) ;
menuBar . add ( mnNewMenu ) ;
mnNewMenu . add ( actSave ) ;
mnNewMenu . add ( actSaveas ) ;
mnNewMenu . addSeparator ( ) ;
mnNewMenu . add ( actExit ) ;
JMenu mnMenu_Fichier = new JMenu ( " Fichier d'analyse " ) ;
menuBar . add ( mnMenu_Fichier ) ;
mnMenu_Fichier . add ( actOpen ) ;
mnMenu_Fichier . addSeparator ( ) ;
mnMenu_Fichier . add ( actAboutFichierAnalyse ) ;
mnMenu_Fichier . add ( actCodeFichierAnalyse ) ;
mnMenu_Fichier . add ( actModifierFichierAnalyse ) ;
JMenu mnMenu_Liste_Etudiant = new JMenu ( " Liste des étudiants " ) ;
menuBar . add ( mnMenu_Liste_Etudiant ) ;
mnMenu_Liste_Etudiant . add ( actChargeListeEtudiantCSV ) ;
mnMenu_Liste_Etudiant . addSeparator ( ) ;
mnMenu_Liste_Etudiant . add ( actAfficheListeEtudiant ) ;
mnMenu_Liste_Etudiant . add ( actVerifCSV ) ;
JMenu mnMenu_Logo = new JMenu ( " Logo " ) ;
menuBar . add ( mnMenu_Logo ) ;
mnMenu_Logo . add ( actChargeLogo ) ;
JMenu mnMenu_Evaluation = new JMenu ( " Evaluation des étudiants " ) ;
menuBar . add ( mnMenu_Evaluation ) ;
mnMenu_Evaluation . add ( actSelectFolder ) ;
mnMenu_Evaluation . addSeparator ( ) ;
mnMenu_Evaluation . add ( actEvaluate ) ;
mnMenu_Evaluation . addSeparator ( ) ;
mnMenu_Evaluation . add ( actVerifHistorique ) ;
JMenu mnMenu_Informations = new JMenu ( " Informations " ) ;
menuBar . add ( mnMenu_Informations ) ;
2022-06-11 12:10:28 +02:00
mnMenu_Informations . add ( actTutoriels ) ;
2022-06-03 21:30:14 +02:00
mnMenu_Informations . addSeparator ( ) ;
2022-06-19 21:01:30 +02:00
mnMenu_Informations . add ( new actAbout ( ) ) ;
2022-06-03 21:30:14 +02:00
}
private void createToolBar ( ) {
toolBar = new JToolBar ( ) ;
JButton btnSelectFileAnalyse = toolBar . add ( actOpen ) ;
2022-11-13 11:57:18 +01:00
btnSelectFileAnalyse . addActionListener ( new ActionListener ( ) {
public void actionPerformed ( ActionEvent e ) {
}
} ) ;
2022-06-03 21:30:14 +02:00
btnSelectFileAnalyse . setHideActionText ( true ) ;
btnSelectFileAnalyse . setIcon ( new ImageIcon ( evaluate . class . getResource ( " /resources/fichierAnalyse.png " ) ) ) ;
JButton btnInformationAnalyse = toolBar . add ( actCodeFichierAnalyse ) ;
btnInformationAnalyse . setHideActionText ( true ) ;
btnInformationAnalyse . setIcon ( new ImageIcon ( evaluate . class . getResource ( " /resources/fichierAnalyseInfo2.png " ) ) ) ;
JButton btnAfficheCodeFichierAnalyse = toolBar . add ( actAboutFichierAnalyse ) ;
btnAfficheCodeFichierAnalyse . setHideActionText ( true ) ;
btnAfficheCodeFichierAnalyse . setIcon ( new ImageIcon ( evaluate . class . getResource ( " /resources/fichierAnalyseInfo.png " ) ) ) ;
toolBar . add ( btnAfficheCodeFichierAnalyse ) ;
JButton btnModifierFichierAnalyse = toolBar . add ( actModifierFichierAnalyse ) ;
btnModifierFichierAnalyse . setIcon ( new ImageIcon ( evaluate . class . getResource ( " /resources/fichierAnalyseModif.png " ) ) ) ;
btnModifierFichierAnalyse . setHideActionText ( true ) ;
toolBar . add ( btnModifierFichierAnalyse ) ;
toolBar . addSeparator ( ) ;
JButton btnEvaluerLesFichiers = toolBar . add ( actEvaluate ) ;
2022-11-15 09:00:37 +01:00
btnEvaluerLesFichiers . addActionListener ( new ActionListener ( ) {
public void actionPerformed ( ActionEvent e ) {
}
} ) ;
2022-06-03 21:30:14 +02:00
btnEvaluerLesFichiers . setHideActionText ( true ) ;
JButton btnFichierCSV = toolBar . add ( actChargeListeEtudiantCSV ) ;
2022-11-22 10:58:30 +01:00
btnFichierCSV . addActionListener ( new ActionListener ( ) {
public void actionPerformed ( ActionEvent e ) {
}
} ) ;
2022-06-03 21:30:14 +02:00
btnFichierCSV . setHideActionText ( true ) ;
btnFichierCSV . setIcon ( new ImageIcon ( evaluate . class . getResource ( " /resources/fichierCSV.png " ) ) ) ;
toolBar . add ( btnFichierCSV ) ;
JButton btnInfoListeEtudiant = toolBar . add ( actAfficheListeEtudiant ) ;
btnInfoListeEtudiant . setIcon ( new ImageIcon ( evaluate . class . getResource ( " /resources/fichierCSVInfo.png " ) ) ) ;
btnInfoListeEtudiant . setHideActionText ( true ) ;
toolBar . add ( btnInfoListeEtudiant ) ;
JButton btnVerificationCSVavecFichierAnalyse = toolBar . add ( actVerifCSV ) ;
btnVerificationCSVavecFichierAnalyse . setIcon ( new ImageIcon ( evaluate . class . getResource ( " /resources/fichierCSVInfoXML.png " ) ) ) ;
btnVerificationCSVavecFichierAnalyse . setHideActionText ( true ) ;
toolBar . add ( btnVerificationCSVavecFichierAnalyse ) ;
toolBar . addSeparator ( ) ;
JButton btnFichierSVG = toolBar . add ( actChargeLogo ) ;
btnFichierSVG . setHideActionText ( true ) ;
btnFichierSVG . setIcon ( new ImageIcon ( evaluate . class . getResource ( " /resources/fichierSVG.png " ) ) ) ;
toolBar . add ( btnFichierSVG ) ;
toolBar . addSeparator ( ) ;
JButton btnSelectFolder = toolBar . add ( actSelectFolder ) ;
2022-11-22 10:58:30 +01:00
btnSelectFolder . addActionListener ( new ActionListener ( ) {
public void actionPerformed ( ActionEvent e ) {
}
} ) ;
2022-06-03 21:30:14 +02:00
btnSelectFolder . setIcon ( new ImageIcon ( evaluate . class . getResource ( " /resources/open.png " ) ) ) ;
btnSelectFolder . setHideActionText ( true ) ;
toolBar . add ( btnSelectFolder ) ;
btnEvaluerLesFichiers . setIcon ( new ImageIcon ( evaluate . class . getResource ( " /resources/evaluate.png " ) ) ) ;
toolBar . add ( btnEvaluerLesFichiers ) ;
JButton btnVerifHistorique = toolBar . add ( actVerifHistorique ) ;
btnVerifHistorique . setIcon ( new ImageIcon ( evaluate . class . getResource ( " /resources/verifhistorique.png " ) ) ) ;
btnVerifHistorique . setHideActionText ( true ) ;
toolBar . add ( btnVerifHistorique ) ;
toolBar . addSeparator ( ) ;
2022-06-19 21:01:30 +02:00
JButton btnAbout = toolBar . add ( new actAbout ( ) ) ;
2022-06-03 21:30:14 +02:00
btnAbout . setIcon ( new ImageIcon ( evaluate . class . getResource ( " /resources/apropos.png " ) ) ) ;
btnAbout . setHideActionText ( true ) ;
toolBar . add ( btnAbout ) ;
2022-06-09 09:13:46 +02:00
JButton btnTutoriels = toolBar . add ( actTutoriels ) ;
btnTutoriels . setIcon ( new ImageIcon ( evaluate . class . getResource ( " /resources/tutoriel.png " ) ) ) ;
toolBar . add ( btnTutoriels ) ;
2022-06-03 21:30:14 +02:00
toolBar . addSeparator ( ) ;
JButton btnExit = toolBar . add ( actExit ) ;
btnExit . setIcon ( new ImageIcon ( evaluate . class . getResource ( " /resources/exit.png " ) ) ) ;
btnExit . setHideActionText ( true ) ;
toolBar . add ( btnExit ) ;
2022-05-24 18:25:41 +02:00
}
2022-05-25 18:21:23 +02:00
/ * *
* Raffraichi les informations
* /
2022-05-24 18:25:41 +02:00
private void refreshLabel ( ) {
if ( ! commandes . fichierAnalyseValide ) {
2022-11-13 11:57:18 +01:00
System . out . println ( " Erreur du fichier d'analyse " ) ;
2022-06-03 21:30:14 +02:00
if ( ! MEPTL . verificationFichierAnalyse . messageErreur . toString ( ) . isEmpty ( ) ) txtpnmessages . setText ( MEPTL . verificationFichierAnalyse . messageErreur . toString ( ) ) ;
2022-11-13 11:57:18 +01:00
chckbxfichiersEtudiants . setEnabled ( false ) ;
2022-05-24 18:25:41 +02:00
chckbxZipfeedback . setEnabled ( false ) ;
chckbxnoFeedback . setEnabled ( false ) ;
chckbxNoNote . setEnabled ( false ) ;
2022-05-25 18:21:23 +02:00
chckCSVNotes . setEnabled ( false ) ;
2022-05-26 20:10:24 +02:00
chckbxNewLogo . setEnabled ( false ) ;
chckbxNoLogo . setEnabled ( false ) ;
2022-05-27 11:40:08 +02:00
chckbxVerif . setEnabled ( false ) ;
2022-05-25 15:28:58 +02:00
} else {
2022-11-13 11:57:18 +01:00
chckbxfichiersEtudiants . setEnabled ( true ) ;
2022-05-25 15:28:58 +02:00
chckbxZipfeedback . setEnabled ( true ) ;
chckbxnoFeedback . setEnabled ( true ) ;
chckbxNoNote . setEnabled ( true ) ;
2022-05-25 18:21:23 +02:00
chckCSVNotes . setEnabled ( true ) ;
2022-05-26 20:10:24 +02:00
chckbxNewLogo . setEnabled ( true ) ;
chckbxNoLogo . setEnabled ( true ) ;
2022-05-27 11:40:08 +02:00
chckbxVerif . setEnabled ( true ) ;
2022-05-25 15:28:58 +02:00
2022-06-11 12:10:28 +02:00
txtpnmessages . afficheChargementFichierAnalyse ( ) ;
2022-05-24 18:25:41 +02:00
}
lblPath . setText ( " <HTML><B><U>Dossier de l'analyse</U></B> : " + commandes . path . substring ( commandes . path . lastIndexOf ( " \\ " ) + 1 , commandes . path . length ( ) ) + " </HTML> " ) ;
2022-05-26 20:10:24 +02:00
lblFileAnalyse . setText ( " <HTML><B><U>Fichier de l'analyse</U></B> : " + commandes . analysis_filename + " </HTML> " ) ;
lblFichierSVG . setText ( " <HTML><B><U>Fichier SVG</U></B> : " + commandes . nameSVG . substring ( commandes . nameSVG . lastIndexOf ( " \\ " ) + 1 , commandes . nameSVG . length ( ) ) + " </HTML> " ) ;
lblFichierCSV . setText ( " <HTML><B><U>Fichier CSV</U></B> : " + commandes . nameCSV + " </HTML> " ) ;
2022-05-27 11:40:08 +02:00
2022-05-24 18:25:41 +02:00
}
2022-06-09 09:13:46 +02:00
/ * *
*
* evaluer l ' ensemble des fichiers des étudiants
* /
2022-06-04 15:43:08 +02:00
private AbstractAction actEvaluate = new AbstractAction ( ) {
private static final long serialVersionUID = 1L ;
{
putValue ( Action . LARGE_ICON_KEY , new ImageIcon ( evaluate . class . getResource ( " /resources/evaluate.png " ) ) ) ;
putValue ( Action . NAME , " Evaluer les fichiers " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( evaluate . class . getResource ( " /resources/evaluatemini.png " ) ) ) ;
putValue ( Action . MNEMONIC_KEY , KeyEvent . VK_E ) ;
putValue ( Action . SHORT_DESCRIPTION , " Evaluer les fichiers (CTRL+E) " ) ;
putValue ( Action . ACCELERATOR_KEY , KeyStroke . getKeyStroke ( KeyEvent . VK_E , InputEvent . CTRL_DOWN_MASK ) ) ;
}
2022-05-24 18:25:41 +02:00
2022-06-04 15:43:08 +02:00
@Override
public void actionPerformed ( ActionEvent e ) {
2022-06-11 12:10:28 +02:00
Thread t2 = new Thread ( new evaluerLesFichiersEtudiants ( txtpnmessages ) ) ;
t2 . start ( ) ;
2022-06-04 15:43:08 +02:00
}
} ;
2022-05-28 19:13:25 +02:00
/ * *
2022-05-31 19:37:46 +02:00
* Ouvre et affiche un fichier XML
2022-05-28 19:13:25 +02:00
* /
private AbstractAction actOpen = new AbstractAction ( ) {
2022-05-25 21:22:38 +02:00
2022-05-28 19:13:25 +02:00
private static final long serialVersionUID = 1L ;
{
putValue ( LARGE_ICON_KEY , new ImageIcon ( evaluate . class . getResource ( " /resources/fichierAnalyse.png " ) ) ) ;
2022-06-01 21:38:37 +02:00
putValue ( Action . NAME , " Ouvrir un nouveau fichier d'analyse " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( create . class . getResource ( " /resources/fichierAnalysemini.png " ) ) ) ;
2022-05-28 19:13:25 +02:00
putValue ( Action . MNEMONIC_KEY , KeyEvent . VK_O ) ;
putValue ( Action . SHORT_DESCRIPTION , " Ouvrir un nouveau fichier d'analyse (CTRL+O) " ) ;
putValue ( Action . ACCELERATOR_KEY , KeyStroke . getKeyStroke ( KeyEvent . VK_O , InputEvent . CTRL_DOWN_MASK ) ) ;
}
@Override
public void actionPerformed ( ActionEvent e ) {
2022-11-13 11:57:18 +01:00
System . out . println ( " Open " ) ;
2022-05-28 19:13:25 +02:00
new filechooserXML ( ) ;
2022-11-13 11:57:18 +01:00
System . out . println ( " Rafraichissement du label informations " ) ;
2022-06-11 12:10:28 +02:00
refreshLabel ( ) ;
2022-11-13 11:57:18 +01:00
System . out . println ( " Open close " ) ;
2022-05-28 19:13:25 +02:00
}
} ;
/ * *
* Charge un logo SVG
* /
private AbstractAction actChargeLogo = new AbstractAction ( ) {
private static final long serialVersionUID = 1L ;
{
2022-06-01 21:38:37 +02:00
putValue ( Action . LARGE_ICON_KEY , new ImageIcon ( evaluate . class . getResource ( " /resources/fichierSVG.png " ) ) ) ;
putValue ( Action . NAME , " Charge un logo SVG " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( evaluate . class . getResource ( " /resources/fichierSVGmini.png " ) ) ) ;
2022-05-28 19:13:25 +02:00
putValue ( Action . MNEMONIC_KEY , KeyEvent . VK_G ) ;
putValue ( Action . SHORT_DESCRIPTION , " Charge un logo SVG (CTRL+G) " ) ;
putValue ( Action . ACCELERATOR_KEY , KeyStroke . getKeyStroke ( KeyEvent . VK_G , InputEvent . CTRL_DOWN_MASK ) ) ;
}
@Override
public void actionPerformed ( ActionEvent e ) {
JFileChooser chooser = new JFileChooser ( ) ;
2022-05-26 20:10:24 +02:00
chooser . setDialogTitle ( " Choisir un fichier SVG " ) ;
chooser . setCurrentDirectory ( new java . io . File ( commandes . path ) ) ;
chooser . setFileSelectionMode ( JFileChooser . FILES_ONLY ) ;
FileNameExtensionFilter filter = new FileNameExtensionFilter ( " Format SVG " , " svg " ) ;
chooser . setFileFilter ( filter ) ;
chooser . setAcceptAllFileFilterUsed ( true ) ;
if ( chooser . showOpenDialog ( null ) = = JFileChooser . APPROVE_OPTION ) {
System . out . println ( " getCurrentDirectory(): " + chooser . getCurrentDirectory ( ) ) ;
System . out . println ( " getSelectedFile() : " + chooser . getSelectedFile ( ) . getAbsolutePath ( ) ) ;
commandes . nameSVG = chooser . getSelectedFile ( ) . getAbsolutePath ( ) ;
commandes . contenuFichierSVG = meptl . chargementFichierSVG ( ) ;
2022-06-09 09:13:46 +02:00
txtpnmessages . setContentType ( " text/plain " ) ;
2022-05-26 20:10:24 +02:00
txtpnmessages . setText ( commandes . contenuFichierSVG ) ;
} else {
commandes . nameSVG = " " ;
commandes . contenuFichierSVG = " " ;
System . out . println ( " No Selection " ) ;
}
2022-05-25 21:22:38 +02:00
refreshLabel ( ) ;
2022-05-28 19:13:25 +02:00
}
} ;
/ * *
* Sélectionne le dossier courant contenant les fichiers des étudiants
* /
private AbstractAction actSelectFolder = new AbstractAction ( ) {
private static final long serialVersionUID = 1L ;
{
2022-06-01 21:38:37 +02:00
putValue ( LARGE_ICON_KEY , new ImageIcon ( evaluate . class . getResource ( " /resources/open.png " ) ) ) ;
putValue ( Action . NAME , " Dossier d'analyse " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( evaluate . class . getResource ( " /resources/openmini.png " ) ) ) ;
2022-05-28 19:13:25 +02:00
putValue ( Action . MNEMONIC_KEY , KeyEvent . VK_U ) ;
2022-06-01 21:38:37 +02:00
putValue ( Action . SHORT_DESCRIPTION , " Dossier d'analyse (CTRL+U) " ) ;
2022-05-28 19:13:25 +02:00
putValue ( Action . ACCELERATOR_KEY , KeyStroke . getKeyStroke ( KeyEvent . VK_U , InputEvent . CTRL_DOWN_MASK ) ) ;
}
@Override
public void actionPerformed ( ActionEvent e ) {
JFileChooser chooser = new JFileChooser ( ) ;
2022-05-26 20:10:24 +02:00
2022-05-28 19:13:25 +02:00
chooser . setCurrentDirectory ( new java . io . File ( commandes . path ) ) ;
chooser . setDialogTitle ( " Sélectionner le dossier contenant les fichiers des étudiants. " ) ;
chooser . setFileSelectionMode ( JFileChooser . DIRECTORIES_ONLY ) ;
chooser . setAcceptAllFileFilterUsed ( false ) ;
if ( chooser . showOpenDialog ( null ) = = JFileChooser . APPROVE_OPTION ) {
System . out . println ( " getCurrentDirectory(): " + chooser . getCurrentDirectory ( ) ) ;
System . out . println ( " getSelectedFile() : " + chooser . getSelectedFile ( ) . getAbsolutePath ( ) ) ;
commandes . path = chooser . getSelectedFile ( ) . getAbsolutePath ( ) ;
} else {
System . out . println ( " No Selection " ) ;
}
2022-05-26 20:10:24 +02:00
2022-05-28 19:13:25 +02:00
refreshLabel ( ) ;
}
} ;
2022-06-01 21:38:37 +02:00
/ * *
/ * *
* Verification
* /
private AbstractAction actVerifHistorique = new AbstractAction ( ) {
2022-05-31 19:37:46 +02:00
private static final long serialVersionUID = 1L ;
{
2022-06-01 21:38:37 +02:00
putValue ( Action . LARGE_ICON_KEY , new ImageIcon ( evaluate . class . getResource ( " /resources/verifhistorique.png " ) ) ) ;
putValue ( Action . NAME , " Evaluer l'historique des modification " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( evaluate . class . getResource ( " /resources/verifhistoriquemini.png " ) ) ) ;
putValue ( Action . MNEMONIC_KEY , KeyEvent . VK_H ) ;
putValue ( Action . SHORT_DESCRIPTION , " Evaluer l'historique des modification (CTRL+H) " ) ;
putValue ( Action . ACCELERATOR_KEY , KeyStroke . getKeyStroke ( KeyEvent . VK_H , InputEvent . CTRL_DOWN_MASK ) ) ;
2022-05-31 19:37:46 +02:00
}
@Override
public void actionPerformed ( ActionEvent e ) {
2022-06-01 21:38:37 +02:00
commandes . verifHisto = true ;
commandes . analyse = false ;
if ( ! commandes . path . isEmpty ( ) ) {
try {
msgBox V = new msgBox ( " Je travaille dure. " , false , false , " Attendez " ) ;
Thread . sleep ( 100 ) ;
meptl . analyseVerifieHistoriqueLesFichiersEtudiantsEtExportNoteCSV ( ) ;
2022-06-09 09:13:46 +02:00
txtpnmessages . setContentType ( " text/plain " ) ;
2022-06-01 21:38:37 +02:00
txtpnmessages . setText ( commandes . message . toString ( ) ) ;
V . close ( ) ;
} catch ( ParserConfigurationException | SAXException | IOException | CloneNotSupportedException e1 ) {
e1 . printStackTrace ( ) ;
} catch ( InterruptedException e1 ) {
e1 . printStackTrace ( ) ;
}
2022-05-31 19:37:46 +02:00
} else {
2022-06-01 21:38:37 +02:00
txtpnmessages . setText ( " *** Veuillez sélectionner un dossier d'analyse. *** " ) ;
2022-05-31 19:37:46 +02:00
}
2022-06-01 21:38:37 +02:00
commandes . verifHisto = false ;
2022-05-31 19:37:46 +02:00
}
} ;
2022-06-01 21:38:37 +02:00
private AbstractAction actVerifCSV = new AbstractAction ( ) {
private static final long serialVersionUID = 1L ;
{
putValue ( Action . LARGE_ICON_KEY , new ImageIcon ( evaluate . class . getResource ( " /resources/fichierCSVInfoXML.png " ) ) ) ;
putValue ( Action . NAME , " Vérification des champs du CSV " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( evaluate . class . getResource ( " /resources/fichierCSVInfoXMLmini.png " ) ) ) ;
putValue ( Action . MNEMONIC_KEY , KeyEvent . VK_U ) ;
putValue ( Action . SHORT_DESCRIPTION , " Vérification des champs du CSV (CTRL+B) " ) ;
putValue ( Action . ACCELERATOR_KEY , KeyStroke . getKeyStroke ( KeyEvent . VK_U , InputEvent . CTRL_DOWN_MASK ) ) ;
}
@Override
public void actionPerformed ( ActionEvent e ) {
if ( commandes . fichierAnalyseValide ) {
if ( commandes . fourniCSV ) {
node settingCSV = commandes . sujet . retourneFirstEnfantsByName ( " import_moodle " ) ;
if ( settingCSV . isHasAttributs ( ) ) {
String email = " inconnu " ;
String name = " inconnu " ;
String firstname = " inconnu " ;
String id = " inconnu " ;
2022-06-09 09:13:46 +02:00
txtpnmessages . setContentType ( " text/plain " ) ;
2022-06-01 21:38:37 +02:00
boolean avertissement = false ;
if ( settingCSV . getAttributs ( ) . get ( " email " ) ! = null ) {
email = settingCSV . getAttributs ( ) . get ( " email " ) ;
}
if ( settingCSV . getAttributs ( ) . get ( " name " ) ! = null ) {
name = settingCSV . getAttributs ( ) . get ( " name " ) ;
}
if ( settingCSV . getAttributs ( ) . get ( " firstname " ) ! = null ) {
firstname = settingCSV . getAttributs ( ) . get ( " firstname " ) ;
}
if ( settingCSV . getAttributs ( ) . get ( " id " ) ! = null ) {
id = settingCSV . getAttributs ( ) . get ( " id " ) ;
}
if ( commandes . nodeCSV . getNodes ( ) . get ( 0 ) . getAttributs ( ) . get ( firstname ) = = null ) {
txtpnmessages . setText ( " *** AVERTISSEMENT - Il n'y a pas le champ " + firstname + " dans le fichier CSV. *** " ) ;
avertissement = true ;
}
if ( commandes . nodeCSV . getNodes ( ) . get ( 0 ) . getAttributs ( ) . get ( name ) = = null ) {
txtpnmessages . setText ( " *** AVERTISSEMENT - Il n'y a pas le champ " + name + " dans le fichier CSV. *** " ) ;
avertissement = true ;
}
if ( commandes . nodeCSV . getNodes ( ) . get ( 0 ) . getAttributs ( ) . get ( id ) = = null ) {
txtpnmessages . setText ( " *** AVERTISSEMENT - Il n'y a pas le champ " + id + " dans le fichier CSV. *** " ) ;
avertissement = true ;
}
if ( commandes . nodeCSV . getNodes ( ) . get ( 0 ) . getAttributs ( ) . get ( email ) = = null ) {
txtpnmessages . setText ( " *** AVERTISSEMENT - Il n'y a pas le champ " + email + " dans le fichier CSV. *** " ) ;
avertissement = true ;
}
if ( ! avertissement ) {
txtpnmessages . setText ( " *** Le fichier CSV contenant la liste des étudiants peut être utilisé avec les paramètres du fichier d'analyse *** " ) ;
}
} else {
txtpnmessages . setText ( " *** Le fichier CSV contenant la liste des étudiants est vide *** " ) ;
}
} else {
txtpnmessages . setText ( " *** Veuillez charger un fichier CSV contenant la liste des étudiants *** " ) ;
new msgBox ( " Le fichier CSV contenant la liste des étudiants n'est pas chargé. " , true , false , " Avertissement " ) ;
}
} else {
txtpnmessages . setText ( " *** Veuillez charger un fichier d'analyse *** " ) ;
new msgBox ( " Le fichier d'analyse n'est pas valide. " , true , false , " Avertissement " ) ;
}
}
} ;
2022-06-11 12:10:28 +02:00
// /**
// * Gènère un nouveau fichier d'analyse à partir d'un fichier ODF
// */
// private AbstractAction actNewFichierAnalyse = new AbstractAction() {
//
// private static final long serialVersionUID = 1L;
//
// {
// putValue(Action.LARGE_ICON_KEY, new ImageIcon(evaluate.class.getResource("/resources/fichierODF.png")));
// putValue( Action.NAME, "Génère un nouveau fichier d'analyse" );
// putValue( Action.SMALL_ICON, new ImageIcon(evaluate.class.getResource("/resources/fichierODFmini.png")) );
// putValue( Action.MNEMONIC_KEY, KeyEvent.VK_N );
// putValue( Action.SHORT_DESCRIPTION, "Générer un nouveau fichier d'analyse (CTRL+N)" );
// putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK) );
// }
//
// @Override
// public void actionPerformed( ActionEvent e ) {
// JFileChooser chooser = new JFileChooser();
// chooser.setDialogTitle("Choisir un fichier ODF");
//
// chooser.setCurrentDirectory(new java.io.File(commandes.path));
// chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
// FileNameExtensionFilter filter = new FileNameExtensionFilter("Format ODF", "odt");
// chooser.setFileFilter(filter);
// chooser.setAcceptAllFileFilterUsed(true);
//
// if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
// System.out.println("getCurrentDirectory(): " + chooser.getCurrentDirectory());
// System.out.println("getSelectedFile() : " + chooser.getSelectedFile().getAbsolutePath());
// commandes.path = chooser.getCurrentDirectory().getAbsolutePath();
// commandes.PathFilenameAnalysis = chooser.getSelectedFile().getAbsolutePath();
// commandes.nameSujet = chooser.getSelectedFile().getName();
//
// Run b = null;
// try {
// b = new Run(commandes.PathFilenameAnalysis);
// node nodSujet = Run.XMLContent(b.getLectDossiers().getEC().getListeContentWriter().get(0));
//
// nodSujet.supprimeTousLesNodesEnfantWithThisName("text:change-start"); //historique des modification
// nodSujet.supprimeTousLesNodesEnfantWithThisName("text:change-end");
//
// commandes.sujetSauvegarde = nodSujet.clone();
//
// nodSujet = meptl.LectureFichierEtudiantSousFormeDeNode(nodSujet,b,0);
// nodSujet.getAttributs().put("analysis_filename","sujet.xml");
// nodSujet = ecritureSujet.nodePourEcritureSujet(nodSujet,b,0);
// Run.ecritureNodeEnXML(nodSujet, "sujet",commandes.path,"Sujet");
// txtpnmessages.setContentType("text/plain");
// txtpnmessages.setText(Run.ecritureNode(nodSujet, 0).toString()
// + "\n\n"
// +"\n*************************"
// +"\nLe fichier sujet.xml a été généré dans le dossier :"
// +"\n" + commandes.path
// +"\n*************************");
// commandes.sujet = nodSujet;
// new verificationFichierAnalyse();
//
// } catch (ParserConfigurationException | SAXException | IOException | CloneNotSupportedException e1) {
// e1.printStackTrace();
// }
//
// } else {
// commandes.nameSujet = "";
// commandes.PathFilenameAnalysis = "";
// System.out.println("No Selection ");
// commandes.fichierAnalyseValide=false;
// refreshLabel();
// }
//
//
// commandes.ecritCode = true;
// }
// };
2022-05-28 19:13:25 +02:00
/ * *
* Information sur le fichier d ' analyse
* /
private AbstractAction actAboutFichierAnalyse = new AbstractAction ( ) {
private static final long serialVersionUID = 1L ;
{
2022-06-01 21:38:37 +02:00
putValue ( Action . NAME , " Informations du fichier d'analyse " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( evaluate . class . getResource ( " /resources/fichierAnalyseInfo2mini.png " ) ) ) ;
2022-05-28 19:13:25 +02:00
putValue ( Action . MNEMONIC_KEY , KeyEvent . VK_K ) ;
2022-06-01 21:38:37 +02:00
putValue ( Action . SHORT_DESCRIPTION , " Informations du fichier d'analyse (CTRL+K) " ) ;
2022-05-28 19:13:25 +02:00
putValue ( Action . ACCELERATOR_KEY , KeyStroke . getKeyStroke ( KeyEvent . VK_K , InputEvent . CTRL_DOWN_MASK ) ) ;
}
@Override public void actionPerformed ( ActionEvent e ) {
if ( commandes . fichierAnalyseValide ) {
2022-06-11 12:10:28 +02:00
txtpnmessages . afficheChargementFichierAnalyse ( ) ;
2022-05-28 19:13:25 +02:00
} else {
2022-06-11 12:10:28 +02:00
txtpnmessages . setText ( baliseStyle . balise ( ) + " <hr class= \" city \" ><h1>*** Veuillez charger un fichier d'analyse ***</h1><hr> " ) ;
2022-05-28 19:13:25 +02:00
}
System . out . println ( " Refresh Labels and texts " ) ;
}
} ;
/ * *
* Quitter l ' application
* /
private AbstractAction actExit = new AbstractAction ( ) {
private static final long serialVersionUID = 1L ;
{
2022-06-01 21:38:37 +02:00
putValue ( Action . NAME , " Quitter " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( evaluate . class . getResource ( " /resources/exitmini.png " ) ) ) ;
putValue ( Action . LARGE_ICON_KEY , new ImageIcon ( evaluate . class . getResource ( " /resources/exit.png " ) ) ) ;
2022-05-28 19:13:25 +02:00
putValue ( Action . MNEMONIC_KEY , KeyEvent . VK_Q ) ;
putValue ( Action . SHORT_DESCRIPTION , " Quitter (CRTL+Q) " ) ;
putValue ( Action . ACCELERATOR_KEY , KeyStroke . getKeyStroke ( KeyEvent . VK_Q , KeyEvent . CTRL_DOWN_MASK ) ) ;
}
@Override public void actionPerformed ( ActionEvent e ) {
2022-06-15 08:03:17 +02:00
if ( JOptionPane . showConfirmDialog ( null , " Voulez-vous quitter analyseWriter? " , " Quitter " , JOptionPane . YES_NO_OPTION , JOptionPane . QUESTION_MESSAGE ) = = JOptionPane . YES_OPTION ) {
dispose ( ) ;
}
2022-05-28 19:13:25 +02:00
}
} ;
2022-06-01 21:38:37 +02:00
2022-06-04 21:12:59 +02:00
/ * *
* Enregistre L ' évaluation
* /
2022-06-01 21:38:37 +02:00
private AbstractAction actSave = new AbstractAction ( ) {
private static final long serialVersionUID = 1L ;
{
putValue ( Action . NAME , " Enregistrer la zone de texte " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( evaluate . class . getResource ( " /resources/savemini.png " ) ) ) ;
putValue ( Action . MNEMONIC_KEY , KeyEvent . VK_S ) ;
putValue ( Action . SHORT_DESCRIPTION , " Enregistrer la zone de texte (CRTL+S) " ) ;
putValue ( Action . ACCELERATOR_KEY , KeyStroke . getKeyStroke ( KeyEvent . VK_S , KeyEvent . CTRL_DOWN_MASK ) ) ;
}
@Override public void actionPerformed ( ActionEvent e ) {
}
} ;
2022-06-04 15:43:08 +02:00
2022-06-04 21:12:59 +02:00
/ * *
* Enregistre sous l ' évaluation
* /
2022-06-04 15:43:08 +02:00
private AbstractAction actSaveas = new AbstractAction ( ) {
private static final long serialVersionUID = 1L ;
{
putValue ( Action . NAME , " Enregistrer la zone de texte sous ... " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( evaluate . class . getResource ( " /resources/saveasmini.png " ) ) ) ;
putValue ( Action . SHORT_DESCRIPTION , " Enregistrer la zone de texte sous ... " ) ;
}
@Override public void actionPerformed ( ActionEvent e ) {
}
} ;
/ * *
*
* /
2022-06-06 09:50:45 +02:00
@SuppressWarnings ( " unused " )
private AbstractAction actSavePreference = new AbstractAction ( ) {
2022-06-01 21:38:37 +02:00
2022-06-04 15:43:08 +02:00
private static final long serialVersionUID = 1L ;
2022-06-01 21:38:37 +02:00
2022-06-04 15:43:08 +02:00
{
putValue ( Action . NAME , " Enregistrer prefrences " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( create . class . getResource ( " /resources/savepreferencemini.png " ) ) ) ;
putValue ( Action . LARGE_ICON_KEY , new ImageIcon ( create . class . getResource ( " /resources/savepreference.png " ) ) ) ;
putValue ( Action . MNEMONIC_KEY , KeyEvent . VK_W ) ;
putValue ( Action . SHORT_DESCRIPTION , " Enregistrer prefrences " ) ;
putValue ( Action . ACCELERATOR_KEY , KeyStroke . getKeyStroke ( KeyEvent . VK_W , KeyEvent . ALT_DOWN_MASK ) ) ;
}
@Override public void actionPerformed ( ActionEvent e ) {
if ( commandes . fichierAnalyseValide ) {
} else {
JOptionPane . showMessageDialog ( null , " Charger un fichier Writer (.odt) ou un fichier d'évaluaton (.xml). " ) ;
}
System . out . println ( " Configuration " ) ;
}
} ;
2022-05-28 19:13:25 +02:00
2022-06-09 09:13:46 +02:00
/ * *
* Affiche les tutoriels sur Youtube
* /
private AbstractAction actTutoriels = new AbstractAction ( ) {
private static final long serialVersionUID = 1L ;
{
putValue ( Action . NAME , " Tutoriels " ) ;
2022-06-11 12:10:28 +02:00
putValue ( Action . SMALL_ICON , new ImageIcon ( create . class . getResource ( " /resources/tutorielmini.png " ) ) ) ;
putValue ( Action . LARGE_ICON_KEY , new ImageIcon ( create . class . getResource ( " /resources/tutoriel.png " ) ) ) ;
2022-06-09 09:13:46 +02:00
putValue ( Action . SHORT_DESCRIPTION , " Tutoriels " ) ;
}
@Override public void actionPerformed ( ActionEvent e ) {
try {
String url = " https://www.youtube.com/channel/UCBSfItcCVnbRJdQbVE9ppjQ " ;
java . awt . Desktop . getDesktop ( ) . browse ( java . net . URI . create ( url ) ) ;
}
catch ( java . io . IOException e1 ) {
System . out . println ( e1 . getMessage ( ) ) ;
}
System . out . println ( " Affiche les tutoriels. " ) ;
}
} ;
2022-05-28 19:13:25 +02:00
/ * *
* Affiche le code XMl du fichier d ' analyse
* /
private AbstractAction actCodeFichierAnalyse = new AbstractAction ( ) {
private static final long serialVersionUID = 1L ;
{
2022-06-01 21:38:37 +02:00
putValue ( Action . NAME , " Affiche le code XML " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( evaluate . class . getResource ( " /resources/fichierAnalyseInfomini.png " ) ) ) ;
putValue ( Action . LARGE_ICON_KEY , new ImageIcon ( evaluate . class . getResource ( " /resources/fichierAnalyseInfo.png " ) ) ) ;
2022-05-28 19:13:25 +02:00
putValue ( Action . MNEMONIC_KEY , KeyEvent . VK_J ) ;
putValue ( Action . SHORT_DESCRIPTION , " Affiche le code XML (CTRL+J) " ) ;
putValue ( Action . ACCELERATOR_KEY , KeyStroke . getKeyStroke ( KeyEvent . VK_J , InputEvent . CTRL_DOWN_MASK ) ) ;
}
@Override public void actionPerformed ( ActionEvent e ) {
2022-06-09 09:13:46 +02:00
txtpnmessages . setContentType ( " text/plain " ) ;
2022-05-27 15:02:18 +02:00
if ( commandes . fichierAnalyseValide ) {
txtpnmessages . setText ( Run . ecritureNode ( commandes . sujet , 0 ) . toString ( ) ) ;
} else {
txtpnmessages . setText ( " *** Veuillez charger un fichier d'analyse *** " ) ;
}
2022-05-28 19:13:25 +02:00
System . out . println ( " Affiche le code XML du fichier d'analyse. " ) ;
}
} ;
/ * *
* Affiche le code XMl du fichier d ' analyse
* /
private AbstractAction actModifierFichierAnalyse = new AbstractAction ( ) {
2022-05-25 18:21:23 +02:00
2022-05-28 19:13:25 +02:00
private static final long serialVersionUID = 1L ;
{
2022-06-01 21:38:37 +02:00
putValue ( Action . NAME , " Modifier le fichier d'analyse " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( evaluate . class . getResource ( " /resources/fichierAnalyseModifmini.png " ) ) ) ;
putValue ( Action . LARGE_ICON_KEY , new ImageIcon ( evaluate . class . getResource ( " /resources/fichierAnalyseModif.png " ) ) ) ;
2022-05-28 19:13:25 +02:00
putValue ( Action . MNEMONIC_KEY , KeyEvent . VK_M ) ;
putValue ( Action . SHORT_DESCRIPTION , " Modifier le fichier d'analyse (CTRL+M) " ) ;
putValue ( Action . ACCELERATOR_KEY , KeyStroke . getKeyStroke ( KeyEvent . VK_M , InputEvent . CTRL_DOWN_MASK ) ) ;
}
@Override public void actionPerformed ( ActionEvent e ) {
2022-06-19 21:01:30 +02:00
create . getInstance ( ) ;
2022-05-31 19:37:46 +02:00
dispose ( ) ;
2022-05-28 19:13:25 +02:00
}
} ;
2022-06-11 12:10:28 +02:00
2022-05-28 19:13:25 +02:00
/ * *
* Charge la liste des étudiants sous la frome d ' un fichier XML .
* /
private AbstractAction actChargeListeEtudiantCSV = new AbstractAction ( ) {
private static final long serialVersionUID = 1L ;
{
2022-06-01 21:38:37 +02:00
putValue ( Action . NAME , " Charge la liste des étudiants " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( evaluate . class . getResource ( " /resources/fichierCSVmini.png " ) ) ) ;
putValue ( Action . LARGE_ICON_KEY , new ImageIcon ( evaluate . class . getResource ( " /resources/fichierCSV.png " ) ) ) ;
2022-05-28 19:13:25 +02:00
putValue ( Action . MNEMONIC_KEY , KeyEvent . VK_L ) ;
putValue ( Action . SHORT_DESCRIPTION , " Charge la liste des étudiants (CTRL+L) " ) ;
putValue ( Action . ACCELERATOR_KEY , KeyStroke . getKeyStroke ( KeyEvent . VK_L , InputEvent . CTRL_DOWN_MASK ) ) ;
}
@Override public void actionPerformed ( ActionEvent e ) {
JFileChooser chooser = new JFileChooser ( ) ;
chooser . setDialogTitle ( " Choisir un fichier CSV " ) ;
chooser . setCurrentDirectory ( new java . io . File ( commandes . path ) ) ;
chooser . setFileSelectionMode ( JFileChooser . FILES_ONLY ) ;
FileNameExtensionFilter filter = new FileNameExtensionFilter ( " Format CSV " , " csv " ) ;
chooser . setFileFilter ( filter ) ;
chooser . setAcceptAllFileFilterUsed ( true ) ;
if ( chooser . showOpenDialog ( null ) = = JFileChooser . APPROVE_OPTION ) {
System . out . println ( " getCurrentDirectory(): " + chooser . getCurrentDirectory ( ) ) ;
System . out . println ( " getSelectedFile() : " + chooser . getSelectedFile ( ) . getAbsolutePath ( ) ) ;
commandes . nameCSV = chooser . getSelectedFile ( ) . getAbsolutePath ( ) ;
commandes . nodeCSV = meptl . chargementFichierCSV ( ) ;
2022-06-09 09:13:46 +02:00
txtpnmessages . setContentType ( " text/plain " ) ;
2022-05-28 19:13:25 +02:00
txtpnmessages . setText ( Run . ecritureNode ( commandes . nodeCSV , 0 ) . toString ( ) ) ;
2022-05-31 19:37:46 +02:00
commandes . fourniCSV = true ;
if ( ! commandes . nodeCSV . getNomElt ( ) . equals ( " fileCSV " ) ) {
commandes . fourniCSV = false ;
}
if ( commandes . nodeCSV . getNodes ( ) . size ( ) < = 0 ) {
commandes . fourniCSV = false ;
txtpnmessages . setText ( " *** Le fichier ne contient pas d'étudiant *** " ) ;
}
2022-05-28 19:13:25 +02:00
} else {
commandes . nameCSV = " " ;
commandes . fourniCSV = false ;
System . out . println ( " No Selection " ) ;
commandes . nodeCSV = new node ( ) ;
refreshLabel ( ) ;
}
System . out . println ( " Charge la liste des étudiants. " ) ;
2022-11-22 10:58:30 +01:00
if ( commandes . fourniCSV ) {
lblChargementFichierCSV . setBackground ( new Color ( 40 , 180 , 40 ) ) ;
lblChargementFichierCSV . setOpaque ( true ) ;
lblFichierCSV . setText ( " <HTML><B><U>Fichier CSV</U></B> : " + commandes . nameCSV + " </HTML> " ) ;
} else {
lblChargementFichierCSV . setOpaque ( false ) ;
lblFichierCSV . setText ( " <HTML><B><U>Fichier CSV</U></B></HTML> " ) ;
}
2022-05-28 19:13:25 +02:00
}
} ;
/ * *
* Affiche le code XMl du fichier d ' analyse
* /
private AbstractAction actAfficheListeEtudiant = new AbstractAction ( ) {
private static final long serialVersionUID = 1L ;
{
2022-06-01 21:38:37 +02:00
putValue ( Action . NAME , " Affiche la liste des étudiants " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( evaluate . class . getResource ( " /resources/fichierCSVInfomini.png " ) ) ) ;
putValue ( Action . LARGE_ICON_KEY , new ImageIcon ( evaluate . class . getResource ( " /resources/fichierCSVInfo.png " ) ) ) ;
2022-05-28 19:13:25 +02:00
putValue ( Action . MNEMONIC_KEY , KeyEvent . VK_L ) ;
putValue ( Action . SHORT_DESCRIPTION , " Affiche la liste des étudiants (ALT+L) " ) ;
putValue ( Action . ACCELERATOR_KEY , KeyStroke . getKeyStroke ( KeyEvent . VK_L , InputEvent . ALT_DOWN_MASK ) ) ;
}
@Override public void actionPerformed ( ActionEvent e ) {
if ( commandes . fourniCSV ) {
txtpnmessages . setText ( Run . ecritureNode ( commandes . nodeCSV , 0 ) . toString ( ) ) ;
} else {
txtpnmessages . setText ( " *** Veuillez sélectionner un fichier CSV contenant la liste des étudiants. *** " ) ;
}
System . out . println ( " Affiche la liste des étudaints déjà en mémoire. " ) ;
}
} ;
2022-06-03 21:30:14 +02:00
2022-05-28 19:13:25 +02:00
2022-06-03 21:30:14 +02:00
// /**
// * Permet l'évaluation des fichiers des étudaints.
// * @throws ParserConfigurationException
// * @throws SAXException
// * @throws IOException
// * @throws CloneNotSupportedException
// */
// private void evaluerLesFichiersEtudiants() throws ParserConfigurationException, SAXException, IOException, CloneNotSupportedException {
//
// commandes.analyse=true;
// progressBarre.setVisible(true);
//
// if(chckbxfichiersEtudaints.isSelected()) commandes.fichierStudentMoodle=true;
// if(chckbxZipfeedback.isSelected()) commandes.zipfeedback=true;
// if(chckbxnoFeedback.isSelected()) commandes.sansFeeback=true;
// if(chckbxNoNote.isSelected()) commandes.noNote=true;
// if(chckCSVNotes.isSelected()) commandes.ecritNoteCSV=true;
// if(chckbxNewLogo.isSelected()) commandes.newLogo=true;
// if(chckbxNoLogo.isSelected()) commandes.noLogo = true;
// if(chckbxVerif.isSelected()) commandes.verifHisto2 = true;
//
// meptl.analyseVerifieHistoriqueLesFichiersEtudiantsEtExportNoteCSV();
//
// txtpnmessages.setText(commandes.message.toString());
//
//
// }
2022-05-26 20:10:24 +02:00
2022-06-03 21:30:14 +02:00
2022-05-25 09:30:49 +02:00
2022-05-24 18:25:41 +02:00
}
2022-06-03 21:30:14 +02:00