V4.1.2 Ajout de la fenêtre setting

This commit is contained in:
pablo rodriguez 2022-06-13 21:56:16 +02:00
parent 2fcef893ce
commit 3226850773
66 changed files with 257 additions and 6 deletions

2
aW.xml
View File

@ -3,7 +3,7 @@
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>C:\Users\pabr6\git\analyseWriter\MEPTL\analyseWriter.jar</jar>
<outfile>C:\Users\pabr6\OneDrive\Desktop\analyseWriter.exe</outfile>
<outfile>C:\Users\pabr6\git\analyseWriter\MEPTL\analyseWriter.exe</outfile>
<errTitle>Erreur</errTitle>
<cmdLine></cmdLine>
<chdir></chdir>

BIN
analyseWriter.exe Normal file

Binary file not shown.

Binary file not shown.

2
bin/.gitignore vendored
View File

@ -1,3 +1,5 @@
/MEPTL/
/app/
/calcul/
/setting$1.class
/setting.class

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -87,8 +87,7 @@ public class create extends JFrame {
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);
//setExtendedState(getExtendedState()|JFrame.MAXIMIZED_BOTH );
ImageIcon img = new ImageIcon(getClass().getResource("/evalwriter.png") );
setTitle(commandes.Titre + " " + commandes.version + " " + commandes.branch);
setIconImage(img.getImage());
@ -109,8 +108,7 @@ public class create extends JFrame {
this.createPopupMenuTree(null);
getContentPane().setLayout(new BorderLayout(2, 2));
contentPane.add( toolBar_1, BorderLayout.NORTH );
// The content of the window
if(commandes.fichierAnalyseValide) tree = commandes.tree;
@ -576,7 +574,7 @@ public class create extends JFrame {
btnNodeFichier.setHideActionText(true);
toolBar_1.add(btnNodeFichier);
JButton btnSetting = new JButton("");
JButton btnSetting = toolBar_1.add( actSetting);
btnSetting.setIcon(new ImageIcon(create.class.getResource("/resources/setting.png")));
toolBar_1.add(btnSetting);
@ -751,6 +749,30 @@ public class create extends JFrame {
}
};
/**
*
*/
private AbstractAction actSetting = new AbstractAction() {
private static final long serialVersionUID = 1L;
{
putValue( Action.NAME, "Settings" );
putValue( Action.SMALL_ICON, new ImageIcon(create.class.getResource("/resources/settingmini.png")) );
putValue( Action.LARGE_ICON_KEY, new ImageIcon(create.class.getResource("/resources/setting.png")) );
putValue( Action.SHORT_DESCRIPTION, "Modifier les paramètres" );
}
@Override public void actionPerformed( ActionEvent e ) {
if(commandes.sujet.getNomElt().equals("fichier")) {
new setting();
}
System.out.println( "ouvre la fenêtre setting" );
}
};
/**
*
*/

227
src/app/setting.java Normal file
View File

@ -0,0 +1,227 @@
package app;
import java.awt.BorderLayout;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import MEPTL.commandes;
import cXML.node;
import javax.swing.JTabbedPane;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import java.awt.Font;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class setting extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JPanel contentPane;
private JTextField textFieldNomEtudiant;
private JTextField textFieldPrenomEtudiant;
private JTextField textFieldEmail;
private JTextField textFieldIDEtudiant;
private JComboBox<String> comboBoxSeparateur;
private JComboBox<String> comboBoxEncodage;
private JButton btnValiderCSV;
/**
* Create the frame.
*/
public setting() {
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 742, 642);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
contentPane.add(tabbedPane, BorderLayout.CENTER);
ImageIcon img = new ImageIcon(getClass().getResource("/evalwriter.png") );
setIconImage(img.getImage());
setTitle(commandes.Titre + commandes.version + " - Les paramètres pour l'évaluation");
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);
ImageIcon img1 = new ImageIcon(getClass().getResource("/fichierCSV.png") );
ImageIcon img3 = new ImageIcon(getClass().getResource("/property.png") );
ImageIcon img4 = new ImageIcon(getClass().getResource("/content.png") );
ImageIcon img2 = new ImageIcon(getClass().getResource("/structurepage.png") );
JPanel panelCSV = new JPanel();
tabbedPane.addTab("Fichier CSV", img1, panelCSV, null);
panelCSV.setLayout(null);
node nodCSV = commandes.sujet.retourneFirstEnfantsByName("csv");
if(nodCSV==null) {
JOptionPane.showMessageDialog(null, "Problème avec le fichier d'analyse.<br>Le node CSV n'est pas dans le fichier.");
return;
}
JLabel lblNewLabel = new JLabel("<html>Les paramètres du fichier CSV permettent, d'écrire et d'importer les notes des étudiants dans le CMS moodle.<br>\r\nCes paramètres seront enregistrés dans le fichier d'analyse.</html>");
lblNewLabel.setVerticalAlignment(SwingConstants.TOP);
lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 14));
lblNewLabel.setHorizontalAlignment(SwingConstants.LEFT);
lblNewLabel.setBounds(10, 11, 691, 42);
panelCSV.add(lblNewLabel);
JLabel lblEncodage = new JLabel("Encodage");
lblEncodage.setFont(new Font("Tahoma", Font.BOLD, 12));
lblEncodage.setBounds(42, 74, 86, 20);
panelCSV.add(lblEncodage);
comboBoxEncodage = new JComboBox<String>();
comboBoxEncodage.setModel(new DefaultComboBoxModel<String>(new String[] {"UTF-8", "US-ASCII", "ISO-8859-1", "UTF-16BE", "UTF-16LE", "UTF-16"}));
comboBoxEncodage.setSelectedItem(nodCSV.getAttributs().get("encoding"));
comboBoxEncodage.setBounds(138, 74, 159, 22);
panelCSV.add(comboBoxEncodage);
JLabel lblSeparateur = new JLabel("Séparateur");
lblSeparateur.setFont(new Font("Tahoma", Font.BOLD, 12));
lblSeparateur.setBounds(370, 74, 86, 20);
panelCSV.add(lblSeparateur);
comboBoxSeparateur = new JComboBox<String>();
comboBoxSeparateur.setModel(new DefaultComboBoxModel<String>(new String[] {"point virgule", "virgule", "espace", "tabulation", ""}));
if(nodCSV.getAttributs().get("separator").equals(";")) comboBoxSeparateur.setSelectedItem("point virgule");
if(nodCSV.getAttributs().get("separator").equals(",")) comboBoxSeparateur.setSelectedItem("virgule");
if(nodCSV.getAttributs().get("separator").equals(" ")) comboBoxSeparateur.setSelectedItem("espace");
if(nodCSV.getAttributs().get("separator").equals("\t")) comboBoxSeparateur.setSelectedItem("tabulation");
comboBoxSeparateur.setBounds(457, 74, 159, 22);
panelCSV.add(comboBoxSeparateur);
JLabel lblveuillezSaisirLes = new JLabel("<html><b>Veuillez saisir des quatre noms des champs.</b><br>\r\nSi vous exportez le fichier depuis moodle, faite correspondre les noms des 4 champs ci-dessous avec celui de votre fichier.</html>");
lblveuillezSaisirLes.setVerticalAlignment(SwingConstants.TOP);
lblveuillezSaisirLes.setHorizontalAlignment(SwingConstants.LEFT);
lblveuillezSaisirLes.setFont(new Font("Tahoma", Font.PLAIN, 14));
lblveuillezSaisirLes.setBounds(10, 120, 691, 60);
panelCSV.add(lblveuillezSaisirLes);
JLabel lblNewLabel_3 = new JLabel("Champ, nom de l'étudiant");
lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 12));
lblNewLabel_3.setBounds(42, 210, 186, 20);
panelCSV.add(lblNewLabel_3);
node nodImportMoodle = nodCSV.retourneFirstEnfantsByName("import_moodle");
if(nodImportMoodle==null) {
JOptionPane.showMessageDialog(null, "Problème avec le fichier d'analyse.<br>le node import_moodle n'est pas dans le fichier d'analyse.");
}
textFieldNomEtudiant = new JTextField();
textFieldNomEtudiant.setFont(new Font("Tahoma", Font.BOLD, 12));
textFieldNomEtudiant.setColumns(10);
textFieldNomEtudiant.setBounds(233, 210, 200, 22);
textFieldNomEtudiant.setText(nodImportMoodle.getAttributs().get("name"));
panelCSV.add(textFieldNomEtudiant);
JLabel lblNewLabel_3_1 = new JLabel("Champ, prénom de l'étudiant");
lblNewLabel_3_1.setFont(new Font("Tahoma", Font.BOLD, 12));
lblNewLabel_3_1.setBounds(42, 260, 186, 20);
panelCSV.add(lblNewLabel_3_1);
textFieldPrenomEtudiant = new JTextField();
textFieldPrenomEtudiant.setFont(new Font("Tahoma", Font.BOLD, 12));
textFieldPrenomEtudiant.setColumns(10);
textFieldPrenomEtudiant.setBounds(233, 260, 200, 22);
textFieldPrenomEtudiant.setText(nodImportMoodle.getAttributs().get("firstname"));
panelCSV.add(textFieldPrenomEtudiant);
JLabel lblNewLabel_3_1_1 = new JLabel("Champ, email de l'étudiant");
lblNewLabel_3_1_1.setFont(new Font("Tahoma", Font.BOLD, 12));
lblNewLabel_3_1_1.setBounds(42, 310, 186, 20);
panelCSV.add(lblNewLabel_3_1_1);
textFieldEmail = new JTextField();
textFieldEmail.setFont(new Font("Tahoma", Font.BOLD, 12));
textFieldEmail.setColumns(10);
textFieldEmail.setBounds(233, 310, 200, 22);
textFieldEmail.setText(nodImportMoodle.getAttributs().get("email"));
panelCSV.add(textFieldEmail);
JLabel lblNewLabel_3_1_1_1 = new JLabel("Champ,numéro de l'étudiant");
lblNewLabel_3_1_1_1.setFont(new Font("Tahoma", Font.BOLD, 12));
lblNewLabel_3_1_1_1.setBounds(42, 360, 186, 20);
panelCSV.add(lblNewLabel_3_1_1_1);
textFieldIDEtudiant = new JTextField();
textFieldIDEtudiant.setFont(new Font("Tahoma", Font.BOLD, 12));
textFieldIDEtudiant.setColumns(10);
textFieldIDEtudiant.setBounds(233, 360, 200, 22);
textFieldIDEtudiant.setText(nodImportMoodle.getAttributs().get("id"));
panelCSV.add(textFieldIDEtudiant);
btnValiderCSV = new JButton("Valider");
btnValiderCSV.setFont(new Font("Tahoma", Font.BOLD, 12));
btnValiderCSV.setBounds(535, 430, 145, 37);
panelCSV.add(btnValiderCSV);
JPanel panelZip = new JPanel();
panelZip.setLayout(null);
tabbedPane.addTab("ZIP", img1, panelZip, null);
JPanel panelPlagiarism = new JPanel();
panelPlagiarism.setLayout(null);
tabbedPane.addTab("Triche", img2, panelPlagiarism, null);
JPanel panelTextSimilarity = new JPanel();
panelTextSimilarity.setLayout(null);
tabbedPane.addTab("Texte similitude", img4, panelTextSimilarity, null);
JPanel panelColor = new JPanel();
panelColor.setLayout(null);
tabbedPane.addTab("Couleur", img4, panelColor, null);
JPanel panelTraduction = new JPanel();
panelTraduction.setLayout(null);
tabbedPane.addTab("Traduction", img4, panelTraduction, null);
ListenerAction();
this.setVisible(true);
}
private void ListenerAction() {
btnValiderCSV.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
node nodCSV = commandes.sujet.retourneFirstEnfantsByName("csv");
nodCSV.getAttributs().put("encoding", comboBoxEncodage.getSelectedItem().toString());
if(comboBoxSeparateur.getSelectedItem().equals("point virgule")) nodCSV.getAttributs().put("separator", ";");
if(comboBoxSeparateur.getSelectedItem().equals("virgule")) nodCSV.getAttributs().put("separator", ",");
if(comboBoxSeparateur.getSelectedItem().equals("espace")) nodCSV.getAttributs().put("separator", " ");
if(comboBoxSeparateur.getSelectedItem().equals("tabulation")) nodCSV.getAttributs().put("separator", "\t");
node nodImport= commandes.sujet.retourneFirstEnfantsByName("import_moodle");
nodImport.getAttributs().put("name", textFieldNomEtudiant.getText());
nodImport.getAttributs().put("firstname", textFieldPrenomEtudiant.getText());
nodImport.getAttributs().put("email", textFieldEmail.getText());
nodImport.getAttributs().put("id", textFieldIDEtudiant.getText());
JOptionPane.showMessageDialog(null, "<html>Les informations ont bien été renseignées.<br>"
+ "N'oubliez pas d'enregistrer votre fichier d'analyse.</html>");
}
});
}
}