package fenetres; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JToolBar; import javax.swing.KeyStroke; import javax.swing.SwingConstants; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.border.EmptyBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.filechooser.FileNameExtensionFilter; import MEPTL.commandes; import MEPTL.meptl; import action.actAbout; import action.actDocumentation; import action.actExit; import action.actLicence; import action.actOpenBaseEvaluation; import action.actSaveEvaluation; import action.actTutoriels; import cXML.Run; import cXML.node; import evaluer.evaluerLesFichiersEtudiants; import net.miginfocom.swing.MigLayout; /** * * @author pablo rodriguez * */ public class evaluate extends JFrame { /** * */ private static final long serialVersionUID = 1L; /** * */ private JToolBar toolBar; private JPanel contentPane; private static JLabel lblPath; private static JLabel lblFileAnalyse; // private static JLabel lblFichierCSV; private static JLabel lblFichierSVG; private static JLabel lblChargementFichierCSV; private static JLabel lblImageDossierEtudiant; private static JLabel lblNoFeedBack; private static JLabel lblNoDeatail; private static JLabel lblnonote; private static JLabel lblnozip; private static JLabel lblVerifHistorique; private static JLabel lblnologo; private static JLabel lblCsvNote; private static JLabel lblNameEvaluation; private static JCheckBox chckbxfichiersEtudiants; private static JCheckBox chckbxZipfeedback; private static JCheckBox chckbxnoFeedback; private static JCheckBox chckbxNoNote; private static JCheckBox chckCSVNotes; private static JCheckBox chckbxNoLogo; private static JCheckBox chckbxVerif; private static JCheckBox chckbxNewLogo; private static JCheckBox chckbxNoDetail; private static afficheText txtpnmessages; private JButton btnChargeEvaluation = new JButton(); private JButton btnSaveEvaluation = new JButton(); private static evaluate instance; public static boolean isDispose = true; /** * Create the frame. */ public void initialize() throws UnsupportedLookAndFeelException{ setSize(1600,900); ImageIcon img = new ImageIcon(getClass().getResource("/evalwriter.png") ); this.setIconImage(img.getImage()); setTitle(commandes.Titre + " " + commandes.version + " " + commandes.branch); setLocationRelativeTo( null ); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); // setBounds(100, 100, 980, 700); 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); createMenu(); createToolBar(); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(new BorderLayout(0, 0)); JPanel panelNord = new JPanel(); contentPane.add(panelNord, BorderLayout.NORTH); panelNord.setLayout(new GridLayout(1, 1, 0, 0)); panelNord.add(toolBar); JPanel panelWestBase = new JPanel(); panelWestBase.setLayout(new BorderLayout(0, 0)); contentPane.add(panelWestBase, BorderLayout.WEST); JPanel panelWestBaseNord = new JPanel(); GridLayout gl_panelWestBaseNord = new GridLayout(); gl_panelWestBaseNord.setRows(4); panelWestBaseNord.setLayout(gl_panelWestBaseNord ); panelWestBase.add(panelWestBaseNord, BorderLayout.NORTH); JPanel panelBoutons = new JPanel(); panelWestBase.add(panelBoutons, BorderLayout.WEST); panelBoutons.setLayout(new MigLayout("", "[24px][260px]", "[][][][][][][][][][][][][][][]")); ImageIcon imgDossierEtudiant = new ImageIcon(getClass().getResource("/dossieretudiant.png") ); JLabel lblIconAccueilEvaluation = new JLabel(""); lblIconAccueilEvaluation.setVerticalAlignment(SwingConstants.TOP); lblIconAccueilEvaluation.setIcon(new ImageIcon(evaluate.class.getResource("/resources/accueil evaluation.png"))); lblIconAccueilEvaluation.setHorizontalAlignment(SwingConstants.LEFT); panelWestBaseNord.add(lblIconAccueilEvaluation, BorderLayout.NORTH); lblNameEvaluation = new JLabel("Evalution :"); panelWestBaseNord.add(lblNameEvaluation); lblNameEvaluation.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblFileAnalyse = new JLabel("Fichier de l'analyse : "); panelWestBaseNord.add(lblFileAnalyse); lblFileAnalyse.setHorizontalAlignment(SwingConstants.LEFT); lblFileAnalyse.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblPath = new JLabel(); panelWestBaseNord.add(lblPath); lblPath.setHorizontalAlignment(SwingConstants.LEFT); lblPath.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblPath.setText("Dossier de l'évaluation : "); // panelWestBaseNord.add(""); chckbxfichiersEtudiants = new JCheckBox("Les fichiers des étudiants
ne sont pas dans des dossiers nominatifs"); chckbxfichiersEtudiants.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if(chckbxfichiersEtudiants.isSelected()) { commandes.fichierStudentMoodle=true; lblImageDossierEtudiant.setIcon(new ImageIcon(getClass().getResource("/resources/fichieretudiant.png"))); }else { commandes.fichierStudentMoodle=false; lblImageDossierEtudiant.setIcon(new ImageIcon(getClass().getResource("/resources/dossieretudiant.png"))); } } }); lblImageDossierEtudiant = new JLabel(imgDossierEtudiant); panelBoutons.add(lblImageDossierEtudiant, "flowx,cell 0 1,alignx left,aligny center"); chckbxfichiersEtudiants.setFont(new Font("Tahoma", Font.PLAIN, 12)); chckbxfichiersEtudiants.setToolTipText("Cochez si les fichiers des étudiants ne sont pas dans des dossier nominatifs"); panelBoutons.add(chckbxfichiersEtudiants, "cell 1 1,growx,aligny center"); chckbxfichiersEtudiants.setSelected(commandes.fichierStudentMoodle); ImageIcon imgDNoFeedBack = new ImageIcon(getClass().getResource("/resources/feedbackstudent.png") ); chckbxnoFeedback = new JCheckBox("Pas de feedback"); chckbxnoFeedback.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if(chckbxnoFeedback.isSelected()) { lblNoFeedBack.setIcon(new ImageIcon(getClass().getResource("/resources/nofeedbackstudent.png"))); commandes.sansFeeback=true; }else { lblNoFeedBack.setIcon(new ImageIcon(getClass().getResource("/resources/feedbackstudent.png"))); commandes.sansFeeback=false; } } }); lblNoFeedBack = new JLabel(imgDNoFeedBack); panelBoutons.add(lblNoFeedBack, "cell 0 2"); chckbxnoFeedback.setToolTipText("Cochez si vous ne voulez pas générer des feedbacks"); chckbxnoFeedback.setFont(new Font("Tahoma", Font.PLAIN, 12)); panelBoutons.add(chckbxnoFeedback, "cell 1 2,growx,aligny top"); chckbxnoFeedback.setSelected(commandes.sansFeeback); ImageIcon imgDNoDetail = new ImageIcon(getClass().getResource("/resources/detailfeedback.png")); chckbxNoDetail = new JCheckBox("Pas de détails dans les feedbacks"); chckbxNoDetail.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if(chckbxNoDetail.isSelected()) { lblNoDeatail.setIcon(new ImageIcon(getClass().getResource("/resources/nodetailfeedback.png"))); commandes.noDetail=true; }else { lblNoDeatail.setIcon(new ImageIcon(getClass().getResource("/resources/detailfeedback.png"))); commandes.noDetail=false; } } }); lblNoDeatail = new JLabel(imgDNoDetail); panelBoutons.add(lblNoDeatail, "cell 0 3"); chckbxNoDetail.setToolTipText("Cochez si vous voulez que la table synthèse dans les feedbacks"); chckbxNoDetail.setFont(new Font("Tahoma", Font.PLAIN, 12)); panelBoutons.add(chckbxNoDetail, "cell 1 3,growx,aligny top"); chckbxNoDetail.setSelected(commandes.noDetail); lblnonote = new JLabel(""); lblnonote.setIcon(new ImageIcon(evaluate.class.getResource("/resources/notestudent.png"))); panelBoutons.add(lblnonote, "cell 0 4"); chckbxNoNote = new JCheckBox("Pas de note dans les feedbacks"); chckbxNoNote.setToolTipText("Cochez si vous voulez pas faire apparaître les notes dans les feedbacks"); chckbxNoNote.setFont(new Font("Tahoma", Font.PLAIN, 12)); chckbxNoNote.setSelected(commandes.noNote); panelBoutons.add(chckbxNoNote, "cell 1 4,grow"); chckbxNoNote.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if(chckbxNoNote.isSelected()) { lblnonote.setIcon(new ImageIcon(evaluate.class.getResource("/resources/nonotestudent.png"))); commandes.noNote=true; }else { lblnonote.setIcon(new ImageIcon(evaluate.class.getResource("/resources/notestudent.png"))); commandes.noNote=false; } } }); lblnozip = new JLabel(""); lblnozip.setIcon(new ImageIcon(evaluate.class.getResource("/resources/zipstudent.png"))); panelBoutons.add(lblnozip, "cell 0 5"); chckbxZipfeedback = new JCheckBox("Zip les feedbacks"); chckbxZipfeedback.setToolTipText("Cochez si vous voulez placer tous les feedbacks dans une archive ZIP"); chckbxZipfeedback.setFont(new Font("Tahoma", Font.PLAIN, 12)); panelBoutons.add(chckbxZipfeedback, "cell 1 5,grow"); chckbxZipfeedback.setSelected(commandes.zipfeedback); chckbxZipfeedback.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if(chckbxZipfeedback.isSelected()) { lblnozip.setIcon(new ImageIcon(evaluate.class.getResource("/resources/zipstudent.png"))); commandes.zipfeedback=true; }else { lblnozip.setIcon(new ImageIcon(evaluate.class.getResource("/resources/nozipstudent.png"))); commandes.zipfeedback=false; } } }); chckbxVerif = new JCheckBox("Vérification des historiques avant analyse"); chckbxVerif.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if(chckbxVerif.isSelected()) { lblVerifHistorique.setIcon(new ImageIcon(evaluate.class.getResource("/resources/verifhistoriquestudent.png"))); commandes.verifHisto2=true; }else { lblVerifHistorique.setIcon(new ImageIcon(evaluate.class.getResource("/resources/noverifhistoriquestudent.png"))); commandes.verifHisto2=false; } } }); lblVerifHistorique = new JLabel(""); lblVerifHistorique.setIcon(new ImageIcon(evaluate.class.getResource("/resources/noverifhistoriquestudent.png"))); panelBoutons.add(lblVerifHistorique, "cell 0 6"); chckbxVerif.setToolTipText("Cochez si vous voulez vérifier les échanges de fichiers entre les étudiants."); chckbxVerif.setFont(new Font("Tahoma", Font.PLAIN, 12)); panelBoutons.add(chckbxVerif, "flowy,cell 1 6,growx,aligny top"); chckbxVerif.setSelected(commandes.verifHisto2); lblChargementFichierCSV = new JLabel("Pas de liste des étudiants"); panelBoutons.add(lblChargementFichierCSV, "cell 1 7,alignx left,aligny center"); // lblFichierCSV = new JLabel("Fichier CSV liste des étudiants :"); // lblFichierCSV.setFont(new Font("Tahoma", Font.BOLD, 14)); // panelBoutons.add(lblFichierCSV, "cell 1 8,grow"); lblCsvNote = new JLabel(""); lblCsvNote.setIcon(new ImageIcon(evaluate.class.getResource("/resources/nocsvstudent.png"))); panelBoutons.add(lblCsvNote, "cell 0 9"); chckCSVNotes = new JCheckBox("Créer un fichier CSV des notes"); chckCSVNotes.setToolTipText("Cochez si vous voulez importer les notes dans un fichier CSV."); panelBoutons.add(chckCSVNotes, "flowx,cell 1 9,grow"); chckCSVNotes.setSelected(commandes.ecritNoteCSV); chckCSVNotes.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if(chckCSVNotes.isSelected()) { lblCsvNote.setIcon(new ImageIcon(evaluate.class.getResource("/resources/csvstudent.png"))); commandes.ecritNoteCSV=true; }else { lblCsvNote.setIcon(new ImageIcon(evaluate.class.getResource("/resources/nocsvstudent.png"))); commandes.ecritNoteCSV=false; } } }); lblFichierSVG = new JLabel("Fichier SVG :"); lblFichierSVG.setFont(new Font("Tahoma", Font.BOLD, 14)); panelBoutons.add(lblFichierSVG, "cell 1 10,growx"); JLabel lblNewLogo = new JLabel(""); lblNewLogo.setIcon(new ImageIcon(evaluate.class.getResource("/resources/newlogo.png"))); panelBoutons.add(lblNewLogo, "cell 0 11"); chckbxNewLogo = new JCheckBox("Nouveau logo"); chckbxNewLogo.setSelected(commandes.newLogo); chckbxNewLogo.setToolTipText("Cochez si vous voulez remplacer le logo par celui au-dessus."); chckbxNewLogo.setFont(new Font("Tahoma", Font.PLAIN, 12)); panelBoutons.add(chckbxNewLogo, "cell 1 11"); chckbxNewLogo.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if(chckbxNewLogo.isSelected()) { lblNewLogo.setIcon(new ImageIcon(evaluate.class.getResource("/resources/newlogo.png"))); chckbxNoLogo.setSelected(true); commandes.newLogo=true; }else { lblNewLogo.setIcon(new ImageIcon(evaluate.class.getResource("/resources/nonewlogo.png"))); commandes.newLogo=false; } } }); lblnologo = new JLabel(""); lblnologo.setIcon(new ImageIcon(evaluate.class.getResource("/resources/logo.png"))); panelBoutons.add(lblnologo, "cell 0 12"); chckbxNoLogo = new JCheckBox("Pas de logo"); chckbxNoLogo.setToolTipText("Cochez si vous voulez pas de logo dans les feedbacks."); chckbxNoLogo.setFont(new Font("Tahoma", Font.PLAIN, 12)); panelBoutons.add(chckbxNoLogo, "cell 1 12"); chckbxNoLogo.setSelected(commandes.noLogo); chckbxNoLogo.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if(chckbxNoLogo.isSelected()) { lblnologo.setIcon(new ImageIcon(evaluate.class.getResource("/resources/nologo.png"))); commandes.noLogo=true; }else { lblnologo.setIcon(new ImageIcon(evaluate.class.getResource("/resources/logo.png"))); commandes.noLogo=false; } } }); JPanel panelCentre = new JPanel(); contentPane.add(panelCentre, BorderLayout.CENTER); panelCentre.setLayout(new BorderLayout(0, 0)); JScrollPane scrollPane = new JScrollPane(); panelCentre.add(scrollPane); txtpnmessages = new afficheText(); txtpnmessages.setForeground(Color.BLACK); txtpnmessages.setFont(new Font("Tahoma", Font.PLAIN, 16)); txtpnmessages.setBackground(Color.LIGHT_GRAY); txtpnmessages.setContentType("text/html"); txtpnmessages.setText(baliseStyle.balise() + "

*** Charger un fichier d'analyse. ***


"); scrollPane.setViewportView(txtpnmessages); if(commandes.fourniCSV) { lblChargementFichierCSV.setBackground(new Color(40,180,40)); lblChargementFichierCSV.setText("Liste des étudiants"); lblChargementFichierCSV.setOpaque(true); // lblFichierCSV.setText("Fichier CSV : " + commandes.nameCSV + ""); }else { lblChargementFichierCSV.setOpaque(false); // lblFichierCSV.setText("Fichier CSV"); } this.setExtendedState(MAXIMIZED_BOTH); ListenerAction(); refreshLabel(); setVisible(true); } private void ListenerAction() { /** * Ferme la fenêtre et quitte l'application. */ 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) { baseDonneesEvaluations.ferme(); create.fermeCreate(); ferme(); } } }); } /** * Affichage de la fenêtre. * @return */ public static evaluate getInstance() { if (instance == null) { instance = new evaluate(); }else { instance.setVisible(true); } if(commandes.fichierAnalyseValide) { refreshLabel(); }else { txtpnmessages.setText(baliseStyle.balise() + "

*** Veuillez charger une évaluation ***


"); } isDispose=false; return instance; } public static void ferme() { if(!isDispose) { isDispose=true; instance.dispose(); } } /** * Create the application. */ public evaluate() { try { initialize(); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } setVisible(true); } /** * Création du menu principal de la fenêtre.
*/ private void createMenu() { JMenuBar menuBar = new JMenuBar(); menuBar.setFont(new Font("Segoe UI", Font.BOLD, 14)); setJMenuBar(menuBar); JMenu mnNewMenu = new JMenu("Base des évaluations"); mnNewMenu.setMnemonic( 'F' ); menuBar.add(mnNewMenu); // mnNewMenu.add( new actPathBaseEvaluations() ); JMenuItem menuItem = mnNewMenu.add( new actOpenBaseEvaluation() ); menuItem.setText("Base des évaluations"); mnNewMenu.addSeparator(); mnNewMenu.add( new actSaveEvaluation() ); // mnNewMenu.add( actSaveas ); mnNewMenu.addSeparator(); mnNewMenu.add( new actExit() ); // JMenu mnMenu_Fichier = new JMenu("Base des évaluation"); // 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(actDeleteListeEtudiantCSV); mnMenu_Liste_Etudiant.addSeparator(); mnMenu_Liste_Etudiant.add(actAfficheListeEtudiant ); mnMenu_Liste_Etudiant.addSeparator(); mnMenu_Liste_Etudiant.add(actModificationListeEtudiantCSV); mnMenu_Liste_Etudiant.addSeparator(); mnMenu_Liste_Etudiant.add(actVerifCSV ); JMenu mnMenu_Logo = new JMenu("Logotype"); menuBar.add(mnMenu_Logo); mnMenu_Logo.add(actChargeLogo); JMenu mnMenu_Evaluation = new JMenu("Evaluer des étudiants"); menuBar.add(mnMenu_Evaluation); JMenuItem menuItem_1 = mnMenu_Evaluation.add(actSelectFolder); menuItem_1.setText("Dossier des étudiants"); mnMenu_Evaluation.addSeparator(); JMenuItem menuItem_2 = mnMenu_Evaluation.add(actEvaluate); menuItem_2.setText("Evaluer les fichiers des étudiants"); mnMenu_Evaluation.addSeparator(); mnMenu_Evaluation.add(actVerifHistorique); JMenu mnMenu_Informations = new JMenu("Aides"); menuBar.add(mnMenu_Informations); mnMenu_Informations.add( new actAbout() ); mnMenu_Informations.addSeparator(); mnMenu_Informations.add(new actDocumentation()); mnMenu_Informations.addSeparator(); mnMenu_Informations.add(new actTutoriels()); mnMenu_Informations.addSeparator(); mnMenu_Informations.add( new actLicence()); } /** * Création de la barre d'outil de la fenêtre.
*/ private void createToolBar() { toolBar = new JToolBar(); btnChargeEvaluation = toolBar.add( new actOpenBaseEvaluation()); btnChargeEvaluation.setIcon(new ImageIcon(create.class.getResource("/resources/chargehistoriqueevaluation.png"))); btnChargeEvaluation.setHideActionText(true); toolBar.add(btnChargeEvaluation); btnSaveEvaluation = toolBar.add( new actSaveEvaluation()); btnSaveEvaluation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); btnSaveEvaluation.setHideActionText( true ); btnSaveEvaluation.setIcon(new ImageIcon(evaluate.class.getResource("/resources/saveEvaluation.png"))); btnSaveEvaluation.setVisible(true); toolBar.add(btnSaveEvaluation); // JButton btnSaveEvluation = toolBar.add( new actSaveHistoriqueEvaluation() ); // btnSaveEvluation.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // } // }); // btnSaveEvluation.setIcon(new ImageIcon(create.class.getResource("/resources/sauvegardehistoriqueevaluation.png"))); // btnSaveEvluation.setHideActionText(true); // toolBar.add(btnSaveEvluation); toolBar.addSeparator(); JButton btnInformationAnalyse = toolBar.add( actCodeFichierAnalyse ); btnInformationAnalyse.setHideActionText(true); btnInformationAnalyse.setIcon(new ImageIcon(evaluate.class.getResource("/resources/fichierAnalyseInfo2.png"))); JButton btnAfficheCodeFichierAnalyse = toolBar.add( actAboutFichierAnalyse ); btnAfficheCodeFichierAnalyse.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); btnAfficheCodeFichierAnalyse.setHideActionText(true); btnAfficheCodeFichierAnalyse.setIcon(new ImageIcon(evaluate.class.getResource("/resources/fichierAnalyseInfo.png"))); toolBar.add(btnAfficheCodeFichierAnalyse); JButton btnModifierFichierAnalyse = toolBar.add(actModifierFichierAnalyse); btnModifierFichierAnalyse.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); btnModifierFichierAnalyse.setIcon(new ImageIcon(evaluate.class.getResource("/resources/versfichierAnalyse.png"))); btnModifierFichierAnalyse.setHideActionText(true); toolBar.add(btnModifierFichierAnalyse); JButton btnEvaluerLesFichiers = toolBar.add(actEvaluate); btnEvaluerLesFichiers.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); btnEvaluerLesFichiers.setHideActionText(true); toolBar.addSeparator(); JButton btnFichierCSV = toolBar.add(actChargeListeEtudiantCSV ); btnFichierCSV.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); btnFichierCSV.setHideActionText(true); btnFichierCSV.setIcon(new ImageIcon(evaluate.class.getResource("/resources/fichierCSV.png"))); toolBar.add(btnFichierCSV); JButton btnFichierCSV_delete = toolBar.add(actDeleteListeEtudiantCSV); btnFichierCSV_delete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); btnFichierCSV_delete.setIcon(new ImageIcon(evaluate.class.getResource("/resources/fichierCSV_delete.png"))); btnFichierCSV_delete.setHideActionText(true); JButton btnInfoListeEtudiant = toolBar.add(actAfficheListeEtudiant); btnInfoListeEtudiant.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); btnInfoListeEtudiant.setIcon(new ImageIcon(evaluate.class.getResource("/resources/fichierCSVInfo.png"))); btnInfoListeEtudiant.setHideActionText(true); toolBar.add(btnInfoListeEtudiant); JButton btnFichierCSV_modifier = toolBar.add(actModificationListeEtudiantCSV); btnFichierCSV_modifier.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); btnFichierCSV_modifier.setIcon(new ImageIcon(evaluate.class.getResource("/resources/fichier_csv_studen_modif.png"))); btnFichierCSV_modifier.setHideActionText(true); JButton btnVerificationCSVavecFichierAnalyse = toolBar.add( actVerifCSV ); btnVerificationCSVavecFichierAnalyse.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); 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); btnSelectFolder.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); 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.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // } // }); // btnVerifHistorique.setIcon(new ImageIcon(evaluate.class.getResource("/resources/verifhistorique.png"))); // btnVerifHistorique.setHideActionText(true); // toolBar.add(btnVerifHistorique); toolBar.addSeparator(); JButton btnAbout = toolBar.add(new actAbout()); btnAbout.setIcon(new ImageIcon(evaluate.class.getResource("/resources/apropos.png"))); if(commandes.newVersion) btnAbout.setIcon(new ImageIcon(evaluate.class.getResource("/resources/apropos_new.png"))); btnAbout.setHideActionText(true); toolBar.add(btnAbout); JButton btnTutoriels = toolBar.add(new actDocumentation()); btnTutoriels.setIcon(new ImageIcon(evaluate.class.getResource("/resources/documentation.png"))); toolBar.add(btnTutoriels); toolBar.addSeparator(); JButton btnExit = toolBar.add(new action.actExit()); btnExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); btnExit.setIcon(new ImageIcon(evaluate.class.getResource("/resources/exit.png"))); btnExit.setHideActionText(true); toolBar.add(btnExit); // ListenerAction(); } /** * Raffraichissement des informationss.
* Activation des chckBoxs.
*/ private static void refreshLabel() { if(!commandes.fichierAnalyseValide) { System.out.println( "Erreur du fichier d'analyse" ); if(!MEPTL.verificationFichierAnalyse.messageErreur.toString().isEmpty()) { txtpnmessages.setText(MEPTL.verificationFichierAnalyse.messageErreur.toString()); } chckbxfichiersEtudiants.setEnabled(false); chckbxZipfeedback.setEnabled(false); chckbxnoFeedback.setEnabled(false); chckbxNoNote.setEnabled(false); chckCSVNotes.setEnabled(false); chckbxNewLogo.setEnabled(false); chckbxNoLogo.setEnabled(false); chckbxVerif.setEnabled(false); chckbxNoDetail.setEnabled(false); }else { chckbxfichiersEtudiants.setSelected(commandes.fichierStudentMoodle); chckbxZipfeedback.setSelected(commandes.zipfeedback); chckbxnoFeedback.setSelected(commandes.sansFeeback); chckCSVNotes.setSelected(commandes.ecritNoteCSV); chckbxNewLogo.setSelected(commandes.newLogo); chckbxNoNote.setSelected(commandes.noNote); chckbxVerif.setSelected(commandes.verifHisto2); chckbxNoDetail.setSelected(commandes.noDetail); chckbxfichiersEtudiants.setEnabled(true); chckbxZipfeedback.setEnabled(true); chckbxnoFeedback.setEnabled(true); chckbxNoNote.setEnabled(true); chckCSVNotes.setEnabled(true); chckbxNewLogo.setEnabled(true); chckbxNoLogo.setEnabled(true); chckbxVerif.setEnabled(true); chckbxNoDetail.setEnabled(true); if(commandes.fourniCSV) { lblChargementFichierCSV.setBackground(new Color(40,180,40)); lblChargementFichierCSV.setText("Liste des étudiants"); lblChargementFichierCSV.setOpaque(true); }else { lblChargementFichierCSV.setOpaque(false); // lblFichierCSV.setText("Fichier CSV"); } txtpnmessages.afficheChargementFichierAnalyse(); } String nameEvaluation = commandes.NameEvaluationCharger; if(nameEvaluation.length()>44) nameEvaluation = nameEvaluation.substring(0, 44) + "
" + nameEvaluation.substring(44, nameEvaluation.length()); String nameDossierAnalyse = commandes.path.substring(commandes.path.lastIndexOf("\\")+1,commandes.path.length()); if(nameDossierAnalyse.length()>44) nameDossierAnalyse = nameDossierAnalyse.substring(0, 44) + "
" + nameDossierAnalyse.substring(44, nameDossierAnalyse.length()); String nameFichierAnalyse = commandes.analysis_filename; if(nameFichierAnalyse.length()>44) nameFichierAnalyse = nameFichierAnalyse.substring(0, 44) + "
" + nameFichierAnalyse.substring(44, nameFichierAnalyse.length()); if(commandes.NameEvaluationCharger!=null) lblNameEvaluation.setText("Évalution :
"+ nameEvaluation +""); if(commandes.path!=null) lblPath.setText("

Dossier de l'analyse :
" + nameDossierAnalyse + "


"); if(commandes.analysis_filename!=null) lblFileAnalyse.setText("Fichier de l'analyse :
" + nameFichierAnalyse + ""); if(commandes.nameSVG!=null) lblFichierSVG.setText("Fichier SVG :
" + commandes.nameSVG.substring(commandes.nameSVG.lastIndexOf("\\")+1,commandes.nameSVG.length()) + ""); // if(commandes.nameCSV!=null) lblFichierCSV.setText("Fichier CSV :
" + commandes.nameCSV + ""); } /** * Getter du texteField txtmessages.
* @return */ public static afficheText getTxtpnmessages() { return txtpnmessages; } /** * Setter du texteField txtmessages.
* @param txtpnmessages */ public static void setTxtpnmessages(afficheText txtpnmessages) { evaluate.txtpnmessages = txtpnmessages; } /** * * Evaluer l'ensemble des fichiers des étudiants.
*/ 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) ); } @Override public void actionPerformed(ActionEvent e) { if(commandes.fichierAnalyseValide) { Thread t2 = new Thread(new evaluerLesFichiersEtudiants(txtpnmessages)); t2.start(); } } }; /** * Ouvre et affiche un fichier d'analyse au format XML.
*/ @SuppressWarnings("unused") private AbstractAction actOpen = new AbstractAction() { private static final long serialVersionUID = 1L; { putValue(LARGE_ICON_KEY, new ImageIcon(evaluate.class.getResource("/resources/fichierAnalyse.png"))); putValue( Action.NAME, "Ouvrir un nouveau fichier d'analyse" ); putValue( Action.SMALL_ICON, new ImageIcon(create.class.getResource("/resources/fichierAnalysemini.png")) ); 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 ) { new ChargeFichierXML(); refreshLabel(); } }; /** * Chargement d'un logo SVG.
*/ private AbstractAction actChargeLogo = new AbstractAction() { private static final long serialVersionUID = 1L; { 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"))); 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(); 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(); txtpnmessages.setContentType("text/plain"); txtpnmessages.setText(commandes.contenuFichierSVG); } else { commandes.nameSVG = ""; commandes.contenuFichierSVG=""; System.out.println("No Selection "); } refreshLabel(); } }; /** * Sélectionne le dossier courant contenant les fichiers des étudiants */ private AbstractAction actSelectFolder = new AbstractAction() { private static final long serialVersionUID = 1L; { 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")) ); putValue( Action.MNEMONIC_KEY, KeyEvent.VK_U ); putValue( Action.SHORT_DESCRIPTION, "Dossier d'analyse (CTRL+U)" ); putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_DOWN_MASK) ); } @Override public void actionPerformed( ActionEvent e ) { JFileChooser chooser = new JFileChooser(); 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) { commandes.path = chooser.getSelectedFile().getAbsolutePath(); } else { System.out.println("No Selection "); } refreshLabel(); } }; /** * Verification de l'historique.
*/ private AbstractAction actVerifHistorique = new AbstractAction() { private static final long serialVersionUID = 1L; { 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) ); } @Override public void actionPerformed( ActionEvent e ) { commandes.verifHisto = true; commandes.analyse = false; if(!commandes.path.isEmpty()) { Thread t2 = new Thread(new evaluerLesFichiersEtudiants(txtpnmessages)); t2.start(); // meptl.analyseVerifieHistoriqueLesFichiersEtudiantsEtExportNoteCSV(fenetres.evaluate.getTxtpnmessages()); txtpnmessages.setContentType("text/plain"); txtpnmessages.setText(commandes.message.toString()); }else { txtpnmessages.setContentType("text/html"); txtpnmessages.setText("

*** Veuillez sélectionner un dossier d'analyse. ***

"); } commandes.verifHisto = false; } }; /** * */ 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"; txtpnmessages.setContentType("text/html"); 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 une évaluation ***

"); new msgBox("Le fichier d'analyse n'est pas valide.",true,false,"Avertissement"); } } }; /** * Information sur le fichier d'analyse.
*/ private AbstractAction actAboutFichierAnalyse = new AbstractAction() { private static final long serialVersionUID = 1L; { putValue( Action.NAME, "Informations du fichier d'analyse" ); putValue( Action.SMALL_ICON, new ImageIcon(evaluate.class.getResource("/resources/fichierAnalyseInfo2mini.png"))); putValue( Action.MNEMONIC_KEY, KeyEvent.VK_K ); putValue( Action.SHORT_DESCRIPTION, "Informations du fichier d'analyse (CTRL+K)" ); putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_K, InputEvent.CTRL_DOWN_MASK) ); } @Override public void actionPerformed( ActionEvent e ) { if(commandes.fichierAnalyseValide) { txtpnmessages.afficheChargementFichierAnalyse(); }else { txtpnmessages.setText(baliseStyle.balise() + "

*** Veuillez charger une évaluation ***


"); } } }; /** * */ @SuppressWarnings("unused") private AbstractAction actSavePreference = new AbstractAction() { private static final long serialVersionUID = 1L; { 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" ); } }; /** * Affiche le code XMl du fichier d'analyse */ private AbstractAction actCodeFichierAnalyse = new AbstractAction() { private static final long serialVersionUID = 1L; { 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")) ); 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 ) { txtpnmessages.setContentType("text/plain"); if(commandes.fichierAnalyseValide) { txtpnmessages.setText(Run.ecritureNode(commandes.sujet, 0).toString()); }else { txtpnmessages.setText("*** Veuillez charger une évaluation ***"); } System.out.println( "Affiche le code XML du fichier d'analyse." ); } }; /** * Affiche le code XMl du fichier d'analyse */ private AbstractAction actModifierFichierAnalyse = new AbstractAction() { private static final long serialVersionUID = 1L; { 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"))); 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 ) { create.getInstance(); evaluate.getInstance().dispose(); evaluate.isDispose=true; } }; /** * Charge la liste des étudiants sous la forme d'un fichier XML. */ private AbstractAction actChargeListeEtudiantCSV = new AbstractAction() { private static final long serialVersionUID = 1L; { 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")) ); 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(); int nbrStudent = 0; if(commandes.nodeCSV==null) { commandes.nodeCSV = new node("fileCSV"); }else { if(commandes.nodeCSV.getNomElt()==null) commandes.nodeCSV.setNomElt("fileCSV"); if(commandes.nodeCSV.getNomElt().isBlank()) commandes.nodeCSV.setNomElt("fileCSV"); nbrStudent = commandes.nodeCSV.getNbrEnfants(); } meptl.chargementFichierCSV(); if(commandes.nodeCSV.getNbrEnfants()>=1) { commandes.fourniCSV=true; } if(commandes.nodeCSV.getNbrEnfants()==nbrStudent) { txtpnmessages.setContentType("text/html"); txtpnmessages.setText("

*** Aucun étudiant a été ajouté à la liste ***

"); }else { if(commandes.fourniCSV) { txtpnmessages.setContentType("text/html"); txtpnmessages.setText(baliseStyle.balise() + meptl.afficheNodeCSV().toString()); System.out.println( "Affiche la liste des étudiants déjà en mémoire." ); }else { txtpnmessages.setContentType("text/html"); txtpnmessages.setText("

*** Veuillez sélectionner un fichier CSV contenant la liste des étudiants. ***

"); } } System.out.println( "Charge la liste des étudiants." ); } if(commandes.fourniCSV) { lblChargementFichierCSV.setBackground(new Color(40,180,40)); lblChargementFichierCSV.setText("Liste des étudiants"); lblChargementFichierCSV.setOpaque(true); // lblFichierCSV.setText("Fichier CSV : " + commandes.nameCSV + ""); }else { lblChargementFichierCSV.setOpaque(false); lblChargementFichierCSV.setText("Pas de liste des étudiants"); // lblFichierCSV.setText("Fichier CSV"); } } }; /** * Supprime la liste des étudiants sous la forme d'un fichier XML. */ private AbstractAction actDeleteListeEtudiantCSV = new AbstractAction() { private static final long serialVersionUID = 1L; { putValue( Action.NAME, "Supprime la liste des étudiants" ); putValue( Action.SMALL_ICON, new ImageIcon(evaluate.class.getResource("/resources/fichierCSV_deletemini.png")) ); putValue( Action.LARGE_ICON_KEY, new ImageIcon(evaluate.class.getResource("/resources/fichierCSV_delete.png")) ); putValue( Action.MNEMONIC_KEY, KeyEvent.VK_L ); putValue( Action.SHORT_DESCRIPTION, "Supprime la liste des étudiants" ); } @Override public void actionPerformed( ActionEvent e ) { if(JOptionPane.showConfirmDialog(null,"Voulez-vous supprimer la liste des étudiant ?", "Supprimer", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.YES_OPTION) { commandes.nodeCSV = meptl.supprimeFichierCSV(); commandes.fourniCSV=false; txtpnmessages.setContentType("text/html"); txtpnmessages.setText("

***Suppression de la liste des étudiants ***

"); System.out.println( "Suppression de la liste des étudiants." ); lblChargementFichierCSV.setOpaque(false); lblChargementFichierCSV.setText("Pas de liste des étudiants"); } } }; /** * Supprime la liste des étudiants sous la forme d'un fichier XML. */ private AbstractAction actModificationListeEtudiantCSV = new AbstractAction() { private static final long serialVersionUID = 1L; { putValue( Action.NAME, "Modification de la liste des étudiants" ); putValue( Action.SMALL_ICON, new ImageIcon(evaluate.class.getResource("/resources/fichier_csv_studen_modifmini.png")) ); putValue( Action.LARGE_ICON_KEY, new ImageIcon(evaluate.class.getResource("/resources/fichier_csv_studen_modif.png")) ); putValue( Action.MNEMONIC_KEY, KeyEvent.VK_L ); putValue( Action.SHORT_DESCRIPTION, "Modification de la liste des étudiants" ); } @Override public void actionPerformed( ActionEvent e ) { txtpnmessages.setContentType("text/html"); if(commandes.fourniCSV) { node nodImportCSV = commandes.sujet.retourneFirstEnfantsByName("import_moodle"); String name = nodImportCSV.getAttributs().get("name"); String email = nodImportCSV.getAttributs().get("email"); String firstname = nodImportCSV.getAttributs().get("firstname"); String id = nodImportCSV.getAttributs().get("id"); String numStudent = JOptionPane.showInputDialog("

Quel est le numéro de l'étudiant ?

"); node nodeStudent = commandes.nodeCSV.retourneFirstNodeByNameAndAttributValueExactStrict("student", id, numStudent); if(nodeStudent!=null) { txtpnmessages.setText("

Etudiant trouvé


Nom : "+ nodeStudent.getAttributs().get(name) +"

" + "

Prenom : "+nodeStudent.getAttributs().get(firstname)+"

" + "

Email : " + nodeStudent.getAttributs().get(email) +"

" + "

Numéro étudiant : "+ nodeStudent.getAttributs().get(id) +"

"); new modifStudent(nodeStudent, nodImportCSV).setVisible(true); System.out.println( "etudiant trouvé." ); }else { txtpnmessages.setText("

*** L'étudiant n'a pas été trouvé. ***"); } }else { txtpnmessages.setText("

*** Veuillez charger une liste d'étudiant à partir d'un fichier au format CSV. ***"); } } }; /** * Affiche le code XMl du fichier d'analyse */ private AbstractAction actAfficheListeEtudiant = new AbstractAction() { private static final long serialVersionUID = 1L; { 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")) ); 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.setContentType("text/html"); txtpnmessages.setText(baliseStyle.balise() + meptl.afficheNodeCSV().toString()); System.out.println( "Affiche la liste des étudiants déjà en mémoire." ); }else { txtpnmessages.setContentType("text/html"); txtpnmessages.setText("

*** Veuillez sélectionner un fichier CSV contenant la liste des étudiants. ***

"); } } }; }