package fenetres; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JLabel; import javax.swing.JOptionPane; import java.awt.Font; import javax.swing.JTextField; import MEPTL.commandes; import MEPTL.meptl; import calcul.calculNotesProgression; import calcul.formatDateWriter; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.DefaultComboBoxModel; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import net.miginfocom.swing.MigLayout; import javax.swing.ImageIcon; import javax.swing.JTextArea; public final class proprieteFichierAnalyse extends JFrame { /** * */ private static final long serialVersionUID = 1L; private JPanel contentPane; private JTextField textFieldTitre; private JTextField textFieldAuteur; private JTextField textFieldMetaSujet; private JTextField textFieldNoteFrom; private JTextField textFieldProgression; private JTextField textFieldDateCreation; private JTextArea textAreaCommentaire; private JComboBox comboBoxPresenceMetaSujet; private JComboBox comboBoxBaremeABC; private JComboBox comboBoxhistoriquePresent; private JComboBox comboBoxcontrole_Initial_Creator; private JComboBox comboBoxcontroleDateCreation; private JComboBox comboBoxcontrole_modificationDateMini; private JLabel lblNewLabel_8; private JLabel lblNewLabel_9; private JTextField textFieldInitial_Creator; private JLabel lblNewLabel_10; private JLabel lblNewLabel_11; private JTextField textFieldlink_help; private JLabel lblNewLabel_12; private JTextField textFieldlink_sujet; private JButton btnAideTitre; private JButton btnAideAuteur; private JButton btnAideMetaSujet; private JButton btnAidePresenceMetaSujet; private JButton btnAideBaremeABC; private JButton btnAideNoteFrom; private JButton btnAideProgression; private JButton btnAideHistoriquePresent; private JButton btnAideDateCreation; private JButton btnAideControleDateCreation; private JButton btnAideInitial_Creator; private JButton btnAidecontrole_Initial_Creator; private JButton btnAidecontrole_URLAide; private JButton btnAidecontrole_dateModificationMini; private JButton btnAidecontrole_URLSujet; private JButton btnAidecontrole_Commentaire; private JButton btnVoirBaremeABC; private JButton btnVoirBaremeNumeric; private static proprieteFichierAnalyse instance; private JLabel lblNewLabel_13; private JLabel lblNewLabel_14; private JTextField textField_dateModificationMini; private JLabel lblNewLabel_15; /** * Create the frame. */ public proprieteFichierAnalyse() { ImageIcon img = new ImageIcon(getClass().getResource("/evalwriter.png") ); setTitle("Propriétés du fichier d'analyse - " + commandes.version + " " + commandes.branch); setIconImage(img.getImage()); setBounds(0, 0, 682, 780); setResizable(false); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 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); contentPane = new JPanel(); contentPane.setBorder(null); setContentPane(contentPane); contentPane.setLayout(new MigLayout("", "[260px][260px,grow][10,grow 20]", "[18px][18px][18px][30px][18px][18px][18px][30px][45px][18px][18px][18px][18px][18px][18px][18px][40px][18px:24px:48px,grow]")); JLabel lblNewLabel = new JLabel("Titre de l'exercice"); lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel, "cell 0 0,alignx left,aligny center"); textFieldTitre = new JTextField(); textFieldTitre.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(textFieldTitre, "cell 1 0,grow"); textFieldTitre.setColumns(10); if(commandes.sujet.getAttributs().get("titre")!=null){ textFieldTitre.setText(commandes.sujet.getAttributs().get("titre")); } btnAideTitre = new JButton(""); btnAideTitre.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showInternalMessageDialog(null, "Le titre de l'exercice apparaît
dans les feedbacks des étudiants."); } }); btnAideTitre.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAideTitre, "cell 2 0"); JLabel lblNewLabel_1 = new JLabel("Auteur"); lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel_1, "cell 0 1,alignx left,aligny center"); textFieldAuteur = new JTextField(); textFieldAuteur.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(textFieldAuteur, "cell 1 1,grow"); textFieldAuteur.setColumns(10); if(commandes.sujet.getAttributs().get("auteur")!=null){ textFieldAuteur.setText(commandes.sujet.getAttributs().get("auteur")); } btnAideAuteur = new JButton(""); btnAideAuteur.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showInternalMessageDialog(null, "L'auteur de l'exercice apparaît
dans les feedbacks des étudiants."); } }); btnAideAuteur.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAideAuteur, "cell 2 1"); JLabel lblNewLabel_2 = new JLabel("metaSujet"); lblNewLabel_2.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel_2, "cell 0 2,alignx left,aligny center"); // Meta textFieldMetaSujet = new JTextField(); textFieldMetaSujet.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(textFieldMetaSujet, "cell 1 2,grow"); textFieldMetaSujet.setColumns(10); if(commandes.sujet.getAttributs().get("metaSujet")!=null){ textFieldMetaSujet.setText(commandes.sujet.getAttributs().get("metaSujet")); } btnAideMetaSujet = new JButton(""); btnAideMetaSujet.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showInternalMessageDialog(null, "La propriété personnalisé Sujet apparaît dans les feedbacks.
" + "Elle est placée sous la note des étudiants.
" + "Si la donnée personnalisé Sujet dans les fichiers des étudiants est présente,
" + "alors il peut y avoir comparaison avec cet valeur (voir la valeur logique suivante)."); } }); btnAideMetaSujet.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAideMetaSujet, "cell 2 2"); JLabel lblNewLabel_3 = new JLabel("

Propriété personnalisé Sujet obligatoire
dans les fichiers des étudiants.

" ); lblNewLabel_3.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel_3, "cell 0 3,alignx left,aligny center"); comboBoxPresenceMetaSujet = new JComboBox(); comboBoxPresenceMetaSujet.setFont(new Font("Tahoma", Font.BOLD, 12)); comboBoxPresenceMetaSujet.setModel(new DefaultComboBoxModel(new String[] {"false", "true"})); contentPane.add(comboBoxPresenceMetaSujet, "cell 1 3,growx,aligny top"); if(commandes.sujet.getAttributs().get("presenceMetaSujet")!=null){ comboBoxPresenceMetaSujet.setSelectedItem(commandes.sujet.getAttributs().get("presenceMetaSujet").toLowerCase()); } btnAidePresenceMetaSujet = new JButton(""); btnAidePresenceMetaSujet.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showInternalMessageDialog(null, "Si la donnée personnalisé Sujet dans les fichiers des étudiants ne correspond pas,
" + "à la valeur au-dessus alors le fichier n'est pas le fichier du sujet.
" + "La note de l'étudiant sera nulle." + "

L'étudiant doit utiliser le fichier remis par l'enseignant.
" + "Cette technique peut être utilisée durant les contrôles.
"); } }); btnAidePresenceMetaSujet.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAidePresenceMetaSujet, "cell 2 3"); JLabel lblNewLabel_4 = new JLabel("Barème alphabétique ABCDE"); lblNewLabel_4.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel_4, "cell 0 4,alignx left"); comboBoxBaremeABC = new JComboBox(); comboBoxBaremeABC.setModel(new DefaultComboBoxModel(new String[] {"false", "true"})); comboBoxBaremeABC.setFont(new Font("Tahoma", Font.BOLD, 12)); contentPane.add(comboBoxBaremeABC, "cell 1 4,growx"); if(commandes.sujet.getAttributs().get("baremeABC")!=null){ comboBoxBaremeABC.setSelectedItem(commandes.sujet.getAttributs().get("baremeABC").toLowerCase()); } btnAideBaremeABC = new JButton(""); btnAideBaremeABC.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "Permet d'utiliser une notation alphabétique à 5 niveaux (de A à E).
" + "Si le coefficient de progression est de 1 alors la largeur des intervalles est de 20%."); } }); btnAideBaremeABC.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAideBaremeABC, "flowx,cell 2 4"); JLabel lblNoteFrom = new JLabel("Barème"); lblNoteFrom.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNoteFrom, "cell 0 5,alignx left"); textFieldNoteFrom = new JTextField(); textFieldNoteFrom.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(textFieldNoteFrom, "cell 1 5,growx"); textFieldNoteFrom.setColumns(10); if(commandes.sujet.getAttributs().get("notefrom")!=null){ textFieldNoteFrom.setText(commandes.sujet.getAttributs().get("notefrom")); } btnAideNoteFrom = new JButton(""); btnAideNoteFrom.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "La notation par défaut est numérique.
" + "La note maximale est par défaut de 20 points.
" + "La note maximale doit être une valeur supérieur strictement 0 point.

" + "Si le coefficient de progression est de 1 alors un exercice à 50% correct
" + "aura la note (maximale/2)."); } }); btnAideNoteFrom.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAideNoteFrom, "flowx,cell 2 5"); JLabel lblNewLabel_5 = new JLabel("Coef. de progression"); lblNewLabel_5.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel_5, "cell 0 6,alignx left"); textFieldProgression = new JTextField(); contentPane.add(textFieldProgression, "cell 1 6,growx"); textFieldProgression.setColumns(10); if(commandes.sujet.getAttributs().get("progression")!=null){ textFieldProgression.setText(commandes.sujet.getAttributs().get("progression")); } btnAideProgression = new JButton(""); btnAideProgression.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "Le coefficient de progression permet de régler la difficulté de l'exercice.

" + "Le coefficient de progression d'affiche dans les feedbacks des étudiants.

" + "Le coefficient de progression doit être compris entre ]0 et 10[.
" + " Un coef. inférieur à 1 signifie qu'il est facile d'atteindre la note maximale
" + " Un coef. supérieur à 1 signifie qu'il est difficile d'atteindre la note maximale."); } }); btnAideProgression.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAideProgression, "cell 2 6"); JLabel lblNewLabel_6 = new JLabel("Le suivi des modifications activé dans les
fichiers des étudiants."); lblNewLabel_6.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel_6, "cell 0 7,alignx left"); comboBoxhistoriquePresent = new JComboBox(); comboBoxhistoriquePresent.setModel(new DefaultComboBoxModel(new String[] {"false", "true"})); comboBoxhistoriquePresent.setFont(new Font("Tahoma", Font.BOLD, 12)); contentPane.add(comboBoxhistoriquePresent, "cell 1 7,growx,aligny top"); if(commandes.sujet.getAttributs().get("historiquePresent")!=null){ comboBoxhistoriquePresent.setSelectedItem(commandes.sujet.getAttributs().get("historiquePresent").toLowerCase()); } btnAideHistoriquePresent = new JButton(""); btnAideHistoriquePresent.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showInternalMessageDialog(null, "Si VRAI alors le suivi des modifications doit être activé dans les fichiers des étudiants.
" + "Si ce n'est pas le cas alors l'étudiant aura une note nulle.

" + "L'étudiant doit utiliser le fichier remis par l'enseignant.
" + "L'enseignant aura activé le suivi des modifications et protégé le suivi par un mot de passe.

" + "Cette technique peut être utilisée durant les contrôles.
" + "Elle permettra de rechercher les fichiers échangés entre les étudiants en comparant les modifications."); } }); btnAideHistoriquePresent.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAideHistoriquePresent, "cell 2 7"); JLabel lblNewLabel_7 = new JLabel("Date de création du fichier transmis
aux étudiants."); lblNewLabel_7.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel_7, "cell 0 8,alignx left"); textFieldDateCreation = new JTextField(); textFieldDateCreation.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(textFieldDateCreation, "cell 1 8,growx"); textFieldDateCreation.setColumns(10); if(commandes.sujet.getAttributs().get("creationDate")!=null){ textFieldDateCreation.setText(commandes.sujet.getAttributs().get("creationDate")); } btnAideDateCreation = new JButton(""); btnAideDateCreation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showInternalMessageDialog(null, "Ne modifier pas cette date.
" + "Sauf, si vous avez remis aux étudiants un nouveau fichier."); } }); btnAideDateCreation.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAideDateCreation, "cell 2 8"); lblNewLabel_8 = new JLabel("La date de création dans les fichers des étudiants doit être le même que celui du fichier fourni."); lblNewLabel_8.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel_8, "cell 0 9,alignx trailing"); comboBoxcontroleDateCreation = new JComboBox(); comboBoxcontroleDateCreation.setModel(new DefaultComboBoxModel(new String[] {"false", "true"})); comboBoxcontroleDateCreation.setFont(new Font("Tahoma", Font.BOLD, 12)); contentPane.add(comboBoxcontroleDateCreation, "cell 1 9,growx,aligny top"); if(commandes.sujet.getAttributs().get("controleDateCreation")!=null){ comboBoxcontroleDateCreation.setSelectedItem(commandes.sujet.getAttributs().get("controleDateCreation").toLowerCase()); } btnAideControleDateCreation = new JButton(""); btnAideControleDateCreation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showInternalMessageDialog(null, "Si VRAI alors la date de création du fichier de l'étudiant doit être identique à celle-ci.
" + "Si ce n'est pas le cas alors l'étudiant aura une note nulle.

" + "L'étudiant doit utiliser le fichier remis par l'enseignant.

" + "Cette technique peut être utilisée durant les contrôles.
" + "Elle permettra de rechercher les fichiers réïnitialisés pour effacer l'historique."); } }); btnAideControleDateCreation.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAideControleDateCreation, "cell 2 9,aligny top"); lblNewLabel_9 = new JLabel("Auteur du fichier fourni aux étudiants."); lblNewLabel_9.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel_9, "cell 0 10,alignx left"); textFieldInitial_Creator = new JTextField(); textFieldInitial_Creator.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(textFieldInitial_Creator, "cell 1 10,growx"); textFieldInitial_Creator.setColumns(10); if(commandes.sujet.getAttributs().get("Initial_Creator")!=null){ textFieldInitial_Creator.setText(commandes.sujet.getAttributs().get("Initial_Creator")); } btnAideInitial_Creator = new JButton(""); btnAideInitial_Creator.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showInternalMessageDialog(null, "Le premier auteur du fichier (créateur).
" + "Ne modifier pas, sauf si vous avez fourni un nouveau fichier aux étudiants avec un autre créateur."); } }); btnAideInitial_Creator.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAideInitial_Creator, "cell 2 10"); lblNewLabel_10 = new JLabel("L'auteur des fichiers des étudiants doit être celui du fichier fourni."); lblNewLabel_10.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel_10, "cell 0 11,alignx trailing"); comboBoxcontrole_Initial_Creator = new JComboBox(); comboBoxcontrole_Initial_Creator.setModel(new DefaultComboBoxModel(new String[] {"false", "true"})); comboBoxcontrole_Initial_Creator.setFont(new Font("Tahoma", Font.BOLD, 12)); contentPane.add(comboBoxcontrole_Initial_Creator, "cell 1 11,growx,aligny top"); if(commandes.sujet.getAttributs().get("controle_Initial_Creator")!=null){ comboBoxcontrole_Initial_Creator.setSelectedItem(commandes.sujet.getAttributs().get("controle_Initial_Creator").toLowerCase()); } btnAidecontrole_Initial_Creator = new JButton(""); btnAidecontrole_Initial_Creator.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showInternalMessageDialog(null, "Si vrai alors le créateur du fichier des étudiants doit correspondre avec cet auteur.
" + "Si ce n'est pas le cas, l'étudiant aura une note nulle.

" + "Cette technique peut être utilisée pour les contrôles."); } }); btnAidecontrole_Initial_Creator.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAidecontrole_Initial_Creator, "cell 2 11"); lblNewLabel_14 = new JLabel("La date et heure du début du contrôle.
C'est la date qui doit être
la plus ancienne dans le fichier des étudiant."); lblNewLabel_14.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel_14, "cell 0 12,alignx left"); textField_dateModificationMini = new JTextField(); textField_dateModificationMini.setFont(new Font("Tahoma", Font.PLAIN, 12)); if(commandes.sujet.getAttributs().get("modificationDateMini")!=null){ textField_dateModificationMini.setText(commandes.sujet.getAttributs().get("modificationDateMini")); } contentPane.add(textField_dateModificationMini, "cell 1 12,growx"); textField_dateModificationMini.setColumns(10); btnAidecontrole_dateModificationMini = new JButton(""); btnAidecontrole_dateModificationMini.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showInternalMessageDialog(null, "Si vous indiquez une date, alors toutes les dates" + "
de modification dans un fichier doivent être postérieures à la date indiquée."); } }); btnAidecontrole_dateModificationMini.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAidecontrole_dateModificationMini, "cell 2 12"); lblNewLabel_15 = new JLabel("La date des modifications doit être
postérieures à la date du début du contrôle."); lblNewLabel_15.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel_15, "cell 0 13,alignx left"); comboBoxcontrole_modificationDateMini = new JComboBox(); comboBoxcontrole_modificationDateMini.setModel(new DefaultComboBoxModel(new String[] {"false", "true"})); comboBoxcontrole_modificationDateMini.setFont(new Font("Tahoma", Font.BOLD, 12)); contentPane.add(comboBoxcontrole_modificationDateMini, "cell 1 13,growx"); if(commandes.sujet.getAttributs().get("controleDateModificationMini")!=null){ comboBoxcontrole_modificationDateMini.setSelectedItem(commandes.sujet.getAttributs().get("controleDateModificationMini").toLowerCase()); } btnAidecontrole_dateModificationMini = new JButton(""); btnAidecontrole_dateModificationMini.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showInternalMessageDialog(null, "Si vrai alors les dates" + "
de modification dans un fichier doivent être postérieures à la date indiquée."); } }); btnAidecontrole_dateModificationMini.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAidecontrole_dateModificationMini, "cell 2 13"); lblNewLabel_11 = new JLabel("Lien URL de l'aide"); lblNewLabel_11.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel_11, "cell 0 14,alignx left"); btnAidecontrole_URLAide = new JButton(""); btnAidecontrole_URLAide.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showInternalMessageDialog(null, "Si vous indiquez une URL alors elle apparaîtra dans" + "le feedback des étudiants."); } }); btnAidecontrole_URLAide.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAidecontrole_URLAide, "cell 2 14"); // URL Aide lblNewLabel_12 = new JLabel("Lien URL du sujet"); lblNewLabel_12.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel_12, "cell 0 15,alignx left"); textFieldlink_help = new JTextField(); textFieldlink_help.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(textFieldlink_help, "cell 1 14,growx"); textFieldlink_help.setColumns(10); if(commandes.sujet.getAttributs().get("link_help")!=null){ textFieldlink_help.setText(commandes.sujet.getAttributs().get("link_help")); } btnVoirBaremeABC = new JButton(""); btnVoirBaremeABC.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { double progression = Double.valueOf(textFieldProgression.getText()); calcul.calculIntervalleBaremeABCDE C = new calcul.calculIntervalleBaremeABCDE(progression); JOptionPane.showMessageDialog(null, C.getMessageHTMLColonne()); } }); btnVoirBaremeABC.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/voirmini.png"))); contentPane.add(btnVoirBaremeABC, "cell 2 4"); // URL Sujet Ligne 13 textFieldlink_sujet = new JTextField(); contentPane.add(textFieldlink_sujet, "cell 1 15,growx"); textFieldlink_sujet.setColumns(10); if(commandes.sujet.getAttributs().get("link_sujet")!=null){ textFieldlink_sujet.setText(commandes.sujet.getAttributs().get("link_sujet")); } btnAidecontrole_URLSujet = new JButton(""); btnAidecontrole_URLSujet.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showInternalMessageDialog(null, "Si vous indiquez une URL alors elle apparaîtra dans" + "le feedback des étudiants."); } }); btnAidecontrole_URLSujet.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAidecontrole_URLSujet, "cell 2 15"); // Commentaire exercice Ligne 14 lblNewLabel_13 = new JLabel("Commentaire sur l'exercice"); lblNewLabel_13.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(lblNewLabel_13, "cell 0 16,alignx left"); textAreaCommentaire = new JTextArea(); textAreaCommentaire.setFont(new Font("Tahoma", Font.PLAIN, 12)); contentPane.add(textAreaCommentaire, "cell 1 16,grow"); if(!commandes.sujet.getContenu().isEmpty()) { if(commandes.sujet.getContenu().get(0)!=null) { String textCommentaire = commandes.sujet.getContenu().get(0).replace("-NewLine-", "\n"); textAreaCommentaire.setText(textCommentaire); } } btnAidecontrole_Commentaire = new JButton(""); btnAidecontrole_Commentaire.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showInternalMessageDialog(null, "Si vous tapez un commentaire, " + "il apparaîtra dans les feedbacks des étudiants."); } }); btnAidecontrole_Commentaire.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/whatmini.png"))); contentPane.add(btnAidecontrole_Commentaire, "cell 2 16"); // Bouton de calcul de la base numérique btnVoirBaremeNumeric = new JButton(""); btnVoirBaremeNumeric.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { double progression = Double.valueOf(textFieldProgression.getText()); double noteFrom = Double.valueOf(textFieldNoteFrom.getText()); calculNotesProgression C = new calculNotesProgression(progression,noteFrom); JOptionPane.showMessageDialog(null, C.getMessageHTMLColonne()); } }); btnVoirBaremeNumeric.setIcon(new ImageIcon(proprieteFichierAnalyse.class.getResource("/resources/voirmini.png"))); contentPane.add(btnVoirBaremeNumeric, "cell 2 5"); // Bouton pour validation JButton btnNewButton = new JButton("Valider"); btnNewButton.setFont(new Font("Tahoma", Font.BOLD, 14)); contentPane.add(btnNewButton, "cell 1 17,grow"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(verifCoefProgression()&&verifBareme()&&formatDateWriter.isCorrect(textFieldDateCreation.getText()) && formatDateWriter.isCorrect(textField_dateModificationMini.getText())){ commandes.sujet.getAttributs().put("titre", textFieldTitre.getText() ); commandes.sujet.getAttributs().put("auteur", textFieldAuteur.getText() ); commandes.sujet.getAttributs().put("metaSujet", textFieldMetaSujet.getText() ); commandes.sujet.getAttributs().put("presenceMetaSujet", comboBoxPresenceMetaSujet.getSelectedItem().toString() ); commandes.sujet.getAttributs().put("baremeABC", comboBoxBaremeABC.getSelectedItem().toString() ); commandes.sujet.getAttributs().put("notefrom", textFieldNoteFrom.getText() ); commandes.sujet.getAttributs().put("progression", textFieldProgression.getText() ); commandes.sujet.getAttributs().put("historiquePresent", comboBoxhistoriquePresent.getSelectedItem().toString() ); commandes.sujet.getAttributs().put("creationDate", textFieldDateCreation.getText() ); commandes.sujet.getAttributs().put("modificationDateMini", textField_dateModificationMini.getText() ); commandes.sujet.getAttributs().put("controleDateCreation", comboBoxcontroleDateCreation.getSelectedItem().toString() ); commandes.sujet.getAttributs().put("controleDateModificationMini", comboBoxcontrole_modificationDateMini.getSelectedItem().toString() ); commandes.sujet.getAttributs().put("Initial_Creator", textFieldInitial_Creator.getText() ); commandes.sujet.getAttributs().put("controle_Initial_Creator", comboBoxcontrole_Initial_Creator.getSelectedItem().toString() ); commandes.sujet.getAttributs().put("link_help", textFieldlink_help.getText() ); commandes.sujet.getAttributs().put("link_sujet", textFieldlink_sujet.getText() ); String textCommentaire = textAreaCommentaire.getText().replace("\n", "-NewLine-"); if(!commandes.sujet.getContenu().isEmpty()) { commandes.sujet.getContenu().remove(0); commandes.sujet.getContenu().add(0, textCommentaire); } meptl.chargementParametresFichierAnalyse(); fenetres.create.getTextNodeSelect().afficheChargementFichierAnalyse(); dispose(); } } }); comboBoxBaremeABC.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String resultat = (String) comboBoxBaremeABC.getSelectedItem(); if(resultat.equals("true")) { lblNoteFrom.setEnabled(false); textFieldNoteFrom.setEnabled(false); textFieldNoteFrom.setEditable(false); }else { lblNoteFrom.setEnabled(true); textFieldNoteFrom.setEnabled(true); textFieldNoteFrom.setEditable(true); } } }); /** * Fermeture de la fenêtre. */ addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent windowEvent) { if(JOptionPane.showConfirmDialog(null,"Voulez-vous quitter cette fenêtre?", "Quitter", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.YES_OPTION) { dispose(); }; } }); Refresh(); this.setVisible(true); } /** * Lorsque le combobox du barème ABC est sélectionner. */ private void Refresh() { if(comboBoxBaremeABC.getSelectedItem().equals("true")) { textFieldNoteFrom.setEditable(false); }else { textFieldNoteFrom.setEditable(true); } } /** * Retourn true si pas d'erreur dans le coefficient de progression * @return */ private boolean verifCoefProgression() { double progression; try { progression = Double.valueOf(textFieldProgression.getText()); }catch (Exception e) { JOptionPane.showMessageDialog(null, "Le coef. de progression doit être une valeur numérique."); return false; } if(progression<0) { JOptionPane.showMessageDialog(null, "Le coef. de progression doit être positif."); return false; } if(progression>100) { JOptionPane.showMessageDialog(null, "Le coef. de progression doit être inférieur strictement à 10."); return false; } return true; } /** * Retourne true si pas d'erreur dans le barème.
* @return */ private boolean verifBareme() { double bareme; try { bareme = Double.valueOf(textFieldNoteFrom.getText()); }catch (Exception e) { JOptionPane.showMessageDialog(null, "Le barème doit être une valeur numérique."); return false; } if(bareme<0) { JOptionPane.showMessageDialog(null, "Le barème doit être positif."); return false; } return true; } public static proprieteFichierAnalyse getInstance() { if (instance == null) { instance = new proprieteFichierAnalyse(); } instance.actualise(); instance.setVisible(true); return instance; } public void actualise() { if(commandes.sujet.getAttributs().get("titre")!=null){ textFieldTitre.setText(commandes.sujet.getAttributs().get("titre")); }else { textFieldTitre.setText(""); } if(commandes.sujet.getAttributs().get("auteur")!=null){ textFieldAuteur.setText(commandes.sujet.getAttributs().get("auteur")); }else { textFieldAuteur.setText(""); } if(commandes.sujet.getAttributs().get("metaSujet")!=null){ textFieldMetaSujet.setText(commandes.sujet.getAttributs().get("metaSujet")); }else { textFieldMetaSujet.setText(""); } if(commandes.sujet.getAttributs().get("notefrom")!=null){ textFieldNoteFrom.setText(commandes.sujet.getAttributs().get("notefrom")); }else { textFieldNoteFrom.setText(""); } if(commandes.sujet.getAttributs().get("progression")!=null){ textFieldProgression.setText(commandes.sujet.getAttributs().get("progression")); }else { textFieldProgression.setText(""); } if(commandes.sujet.getAttributs().get("creationDate")!=null){ textFieldDateCreation.setText(commandes.sujet.getAttributs().get("creationDate")); }else { textFieldDateCreation.setText(""); } if(commandes.sujet.getAttributs().get("modificationDateMini")!=null){ textField_dateModificationMini.setText(commandes.sujet.getAttributs().get("modificationDateMini")); }else { textField_dateModificationMini.setText(""); } if(commandes.sujet.getAttributs().get("presenceMetaSujet")!=null){ comboBoxPresenceMetaSujet.setSelectedItem(commandes.sujet.getAttributs().get("presenceMetaSujet").toLowerCase()); }else { comboBoxPresenceMetaSujet.setSelectedItem(String.valueOf(commandes.analyse_presenceMetaSujet)); } if(commandes.sujet.getAttributs().get("baremeABC")!=null){ comboBoxBaremeABC.setSelectedItem(commandes.sujet.getAttributs().get("baremeABC").toLowerCase()); }else { comboBoxBaremeABC.setSelectedItem(String.valueOf(commandes.analyse_baremeABC)); } if(commandes.sujet.getAttributs().get("historiquePresent")!=null){ comboBoxhistoriquePresent.setSelectedItem(commandes.sujet.getAttributs().get("historiquePresent").toLowerCase()); }else { comboBoxhistoriquePresent.setSelectedItem(String.valueOf(commandes.analyse_historiquePresent)); } if(commandes.sujet.getAttributs().get("controle_Initial_Creator")!=null){ comboBoxcontrole_Initial_Creator.setSelectedItem(commandes.sujet.getAttributs().get("controle_Initial_Creator").toLowerCase()); }else { comboBoxcontrole_Initial_Creator.setSelectedItem(String.valueOf(commandes.analyse_controle_Initial_Creator)); } if(commandes.sujet.getAttributs().get("controleDateCreation")!=null){ comboBoxcontroleDateCreation.setSelectedItem(commandes.sujet.getAttributs().get("controleDateCreation").toLowerCase()); }else { comboBoxcontroleDateCreation.setSelectedItem(String.valueOf(commandes.analyse_controleDateCreation)); } if(commandes.sujet.getAttributs().get("controleDateModificationMini")!=null){ comboBoxcontrole_modificationDateMini.setSelectedItem(commandes.sujet.getAttributs().get("controleDateModificationMini").toLowerCase()); }else { comboBoxcontrole_modificationDateMini.setSelectedItem(String.valueOf(commandes.analyse_controleDateModificationMini)); } } }