MAJ
This commit is contained in:
parent
ce73ffa0d2
commit
af42a93f7b
|
@ -6,5 +6,6 @@
|
|||
<classpathentry kind="lib" path="C:/Users/pabr6/eclipse-workspace/zip4j-1.2.7.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/pabr6/git/analyseWriter/MEPTL/miglayout15-swing.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/pabr6/eclipse-workspace/cXML.jar"/>
|
||||
<classpathentry kind="lib" path="jgoodies-forms-1.8.0.jar" sourcepath="jgoodies-forms-1.8.0-sources.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
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.
|
@ -138,9 +138,9 @@ public class verificationFichierAnalyse {
|
|||
|
||||
|
||||
//vérification du node structure
|
||||
if(commandes.sujet.retourneEnfantsByNameExist("structurepage")) {
|
||||
verifNodeAutoriserDansStructure(commandes.sujet.retourneFirstEnfantsByName("structurepage"));
|
||||
}
|
||||
// if(commandes.sujet.retourneEnfantsByNameExist("structurepage")) {
|
||||
// verifNodeAutoriserDansStructure(commandes.sujet.retourneFirstEnfantsByName("structurepage"));
|
||||
// }
|
||||
|
||||
//vérification du node setting
|
||||
if(commandes.sujet.retourneEnfantsByNameExist("setting")) {
|
||||
|
@ -432,6 +432,7 @@ public class verificationFichierAnalyse {
|
|||
* @param structure
|
||||
* @throws CloneNotSupportedException
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private static void verifNodeAutoriserDansStructure(node structure) throws CloneNotSupportedException {
|
||||
|
||||
String nom = structure.getNomElt();
|
||||
|
@ -774,7 +775,9 @@ public class verificationFichierAnalyse {
|
|||
* @param nod
|
||||
*/
|
||||
private static void verifLongContenuNode(node nod) {
|
||||
if( nod.getContenu().contains("‽") ) {
|
||||
if(nod==null) return;
|
||||
|
||||
if(!nod.getContenu().isEmpty()) if( nod.getContenu().contains("‽") ) {
|
||||
if(nod.getAttributs().get("evaluer")!=null) {
|
||||
if(nod.getAttributs().get("evaluer").equalsIgnoreCase("true")) {
|
||||
if( outils.NetTexte(nod.getContenu().get(0)).length() <=3 ) {
|
||||
|
@ -795,7 +798,7 @@ public class verificationFichierAnalyse {
|
|||
}
|
||||
}
|
||||
|
||||
if( nod.getAttributs().get("allContent")!=null && nod.getAttributs().get("evaluer")!=null ) {
|
||||
if(!nod.getAttributs().isEmpty()) if( nod.getAttributs().get("allContent")!=null && nod.getAttributs().get("evaluer")!=null ) {
|
||||
if(nod.getAttributs().get("evaluer").equalsIgnoreCase("true")) {
|
||||
String A = nod.getAttributs().get("allContent");
|
||||
Pattern pt = Pattern.compile("[1-9]$|[1-9][0-9]$");
|
||||
|
@ -902,6 +905,26 @@ public class verificationFichierAnalyse {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param nomFichier
|
||||
* @throws CloneNotSupportedException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void MiseAJourHashNomFichierAnalyse(String nomFichier) throws CloneNotSupportedException, IOException {
|
||||
if(!nomFichier.contains(".xml")) nomFichier= nomFichier+".xml";
|
||||
|
||||
commandes.hash = String.valueOf(Run.HashNode(commandes.sujet,0));
|
||||
commandes.sujet.getAttributs().put("hash",String.valueOf(commandes.hash));
|
||||
|
||||
commandes.analysis_filename = nomFichier;
|
||||
commandes.sujet.getAttributs().put("analysis_filename",nomFichier);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Permet l'écriture du fichier sujet.xml sans les nodes non évaluer.
|
||||
* @throws CloneNotSupportedException
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.awt.event.MouseAdapter;
|
|||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -41,17 +42,29 @@ import javax.swing.JTree;
|
|||
import javax.swing.KeyStroke;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
import javax.swing.event.TreeExpansionEvent;
|
||||
import javax.swing.event.TreeExpansionListener;
|
||||
import javax.swing.event.TreeWillExpandListener;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
import javax.swing.tree.ExpandVetoException;
|
||||
import javax.swing.tree.TreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
import javax.swing.tree.TreeSelectionModel;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import MEPTL.commandes;
|
||||
import MEPTL.ecritureSujet;
|
||||
import MEPTL.meptl;
|
||||
import MEPTL.verificationFichierAnalyse;
|
||||
import cXML.Run;
|
||||
import cXML.node;
|
||||
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
|
||||
|
||||
|
@ -63,6 +76,8 @@ public class create extends JFrame {
|
|||
private JEditorPane textNodeSelect = new JEditorPane();
|
||||
private JToolBar toolBar = new JToolBar();
|
||||
private JMenuBar menuBar = new JMenuBar();
|
||||
|
||||
|
||||
|
||||
private JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
||||
|
||||
|
@ -160,6 +175,7 @@ public class create extends JFrame {
|
|||
// Construction et injection de la barre d'outils
|
||||
JPanel contentPane = (JPanel) getContentPane();
|
||||
this.createToolBar();
|
||||
this.createPopupMenuTree();
|
||||
getContentPane().setLayout(new BorderLayout(2, 2));
|
||||
contentPane.add( toolBar, BorderLayout.NORTH );
|
||||
|
||||
|
@ -435,10 +451,7 @@ public class create extends JFrame {
|
|||
tree.setFont(new Font("Tahoma", Font.PLAIN, 14));
|
||||
|
||||
|
||||
if(commandes.fichierAnalyseValide) {
|
||||
constructionTree();
|
||||
}
|
||||
|
||||
if(commandes.fichierAnalyseValide) constructionTree();
|
||||
ListenerAction();
|
||||
|
||||
|
||||
|
@ -456,7 +469,12 @@ public class create extends JFrame {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// tree.addTreeWillExpandListener(new MyTreeWillExpandListener());
|
||||
// tree.addTreeExpansionListener(new MyTreeExpansionListener());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -542,6 +560,10 @@ public class create extends JFrame {
|
|||
*/
|
||||
private JPopupMenu createPopupMenuTree() {
|
||||
|
||||
JMenu mnEvaluer = new JMenu("Evaluer");
|
||||
mnEvaluer.add(actEvalueTrue);
|
||||
mnEvaluer.add(actEvalueFalse);
|
||||
|
||||
JMenu mnManageTree = new JMenu("Arbre");
|
||||
mnManageTree.add(actExpandAll);
|
||||
mnManageTree.add(actExpandNode);
|
||||
|
@ -549,9 +571,15 @@ public class create extends JFrame {
|
|||
mnManageTree.add(actCollapseAll);
|
||||
mnManageTree.add(actCollapseNode);
|
||||
|
||||
JMenu mnNiveauPrincipal = new JMenu("Node niveau 1");
|
||||
mnNiveauPrincipal.add("Ajoute une lien de menu");
|
||||
mnNiveauPrincipal.add("Ajoute un titre de menu");
|
||||
mnNiveauPrincipal.add("Coefficient");
|
||||
|
||||
JPopupMenu mnPopupTree = new JPopupMenu();
|
||||
mnPopupTree.add(actEvalueTrue);
|
||||
mnPopupTree.add(actEvalueFalse);
|
||||
mnPopupTree.add(mnEvaluer);
|
||||
mnPopupTree.addSeparator();
|
||||
mnPopupTree.add(mnNiveauPrincipal);
|
||||
mnPopupTree.addSeparator();
|
||||
mnPopupTree.add(actNodeFichier);
|
||||
mnPopupTree.addSeparator();
|
||||
|
@ -603,6 +631,8 @@ public class create extends JFrame {
|
|||
|
||||
mnuModif.add( actOpen );
|
||||
mnuModif.add( actNodeFichier );
|
||||
mnuModif.addSeparator();
|
||||
mnuModif.add( actNewFichierAnalyse );
|
||||
|
||||
menuBar.add(mnuModif);
|
||||
|
||||
|
@ -635,7 +665,13 @@ public class create extends JFrame {
|
|||
JButton buttonLoadFile = toolBar.add( actOpen );
|
||||
buttonLoadFile.setIcon(new ImageIcon(create.class.getResource("/resources/fichierAnalyse.png")));
|
||||
buttonLoadFile.setHideActionText(true);
|
||||
buttonLoadFile.setHideActionText( true );
|
||||
toolBar.add(buttonLoadFile);
|
||||
|
||||
|
||||
JButton btnNewFichierAnalyse = toolBar.add( actNewFichierAnalyse );
|
||||
btnNewFichierAnalyse.setIcon(new ImageIcon(create.class.getResource("/resources/fichierODF.png")));
|
||||
btnNewFichierAnalyse.setHideActionText(true);
|
||||
toolBar.add(btnNewFichierAnalyse);
|
||||
|
||||
JButton btnNodeFichier = toolBar.add( actNodeFichier );
|
||||
btnNodeFichier.setIcon(new ImageIcon(create.class.getResource("/resources/nodeFichier.png")));
|
||||
|
@ -709,6 +745,10 @@ public class create extends JFrame {
|
|||
constructionTree();
|
||||
textNodeSelect.setText("Le chargement de la nouvelle structure est réussi.");
|
||||
MAJToolBar();
|
||||
}else {
|
||||
constructionTree();
|
||||
textNodeSelect.setText(commandes.message.toString());
|
||||
MAJToolBar();
|
||||
}
|
||||
System.out.println( "Open" );
|
||||
}
|
||||
|
@ -730,13 +770,11 @@ public class create extends JFrame {
|
|||
}
|
||||
|
||||
@Override public void actionPerformed( ActionEvent e ) {
|
||||
new filechooserXML();
|
||||
if(commandes.fichierAnalyseValide) {
|
||||
constructionTree();
|
||||
textNodeSelect.setText("Le chargement de la nouvelle structure est réussi.");
|
||||
MAJToolBar();
|
||||
if(commandes.sujet.getNomElt().equals("fichier")) {
|
||||
new proprieteFichierAnalyse();
|
||||
|
||||
}
|
||||
System.out.println( "Open" );
|
||||
System.out.println( "ouvre la fenêtre propriété du fichier d'analyse" );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -784,18 +822,22 @@ public class create extends JFrame {
|
|||
Pattern p = Pattern.compile("[.xml]\\b");
|
||||
Matcher m = p.matcher(commandes.nameSujet);
|
||||
|
||||
String message="\"Voulez-vous enregistrer le fichier \"" + commandes.nameSujet + ".xml\"\n"
|
||||
+ "Dans le dossier " + commandes.path;
|
||||
String message="";
|
||||
|
||||
if(m.find()) {
|
||||
message="\"Voulez-vous enregistrer le fichier \"" + commandes.nameSujet + "\"\n"
|
||||
+ "Dans le dossier " + commandes.path;
|
||||
}else {
|
||||
message="\"Voulez-vous enregistrer le fichier \"" + commandes.nameSujet + ".xml\"\n"
|
||||
+ "Dans le dossier " + commandes.path;
|
||||
commandes.nameSujet = commandes.nameSujet + ".xml";
|
||||
}
|
||||
|
||||
int input = JOptionPane.showConfirmDialog(null, message);
|
||||
|
||||
if(input==0) {
|
||||
try {
|
||||
verificationFichierAnalyse.MiseAJourHashNomFichierAnalyse(commandes.nameSujet);
|
||||
Run.ecritureNodeEnXML(commandes.sujet, commandes.nameSujet ,commandes.path,"sujet");
|
||||
|
||||
if(m.find()) {
|
||||
|
@ -807,7 +849,7 @@ public class create extends JFrame {
|
|||
}
|
||||
|
||||
System.out.println( input + "Save" );
|
||||
} catch (IOException e1) {
|
||||
} catch (IOException | CloneNotSupportedException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -838,6 +880,8 @@ public class create extends JFrame {
|
|||
file = new File(commandes.path ); //+ "\\" + utils.filename + ".xml"
|
||||
}
|
||||
|
||||
|
||||
|
||||
fileChooser.setCurrentDirectory(file);
|
||||
|
||||
int userSelection = fileChooser.showSaveDialog(null);
|
||||
|
@ -845,6 +889,10 @@ public class create extends JFrame {
|
|||
if (userSelection == JFileChooser.APPROVE_OPTION) {
|
||||
File fileToSave = fileChooser.getSelectedFile();
|
||||
try {
|
||||
|
||||
verificationFichierAnalyse.MiseAJourHashNomFichierAnalyse(fileToSave.getName());
|
||||
|
||||
|
||||
Run.ecritureNodeEnXML(commandes.sujet, fileToSave.getName(), fileToSave.getPath().substring(0,fileToSave.getPath().lastIndexOf("\\")),"sujet" );
|
||||
|
||||
commandes.nameSujet = fileToSave.getName();
|
||||
|
@ -864,7 +912,10 @@ public class create extends JFrame {
|
|||
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
} catch (CloneNotSupportedException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
System.out.println("Save as file: " + fileToSave.getAbsolutePath());
|
||||
}
|
||||
System.out.println( "Save as" );
|
||||
|
@ -1048,8 +1099,15 @@ public class create extends JFrame {
|
|||
|
||||
if(a == JOptionPane.YES_NO_OPTION) {
|
||||
node nod = (node) selectNode.getUserObject();
|
||||
nod.getParent().supprimeNodeEnfant(nod);
|
||||
constructionTree();
|
||||
if(!(nod.getNomElt().equals("setting")||nod.getNomElt().equals("csv")||nod.getNomElt().equals("import_moodle")||nod.getNomElt().equals("zip")
|
||||
||nod.getNomElt().equals("plagiarism")||nod.getNomElt().equals("text:similarity")||nod.getNomElt().equals("color") ||nod.getNomElt().equals("translation") )) {
|
||||
nod.getParent().supprimeNodeEnfant(nod);
|
||||
constructionTree();
|
||||
}else {
|
||||
JOptionPane.showMessageDialog(null,"Vous ne devez pas supprimer ce node !", "Oh non!!!", JOptionPane.INFORMATION_MESSAGE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1280,7 +1338,75 @@ public class create extends JFrame {
|
|||
}
|
||||
System.out.println( "Configuration" );
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Gènère un nouveau fichier d'analyse à partir d'un fichier ODF
|
||||
*/
|
||||
private AbstractAction actNewFichierAnalyse = new AbstractAction() {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
{
|
||||
putValue(Action.LARGE_ICON_KEY, new ImageIcon(evaluate.class.getResource("/resources/fichierODF.png")));
|
||||
putValue( Action.NAME, "Génère un nouveau fichier d'analyse" );
|
||||
putValue( Action.SMALL_ICON, new ImageIcon(evaluate.class.getResource("/resources/fichierODFmini.png")) );
|
||||
putValue( Action.MNEMONIC_KEY, KeyEvent.VK_N );
|
||||
putValue( Action.SHORT_DESCRIPTION, "Générer un nouveau fichier d'analyse (CTRL+N)" );
|
||||
putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e ) {
|
||||
JFileChooser chooser = new JFileChooser();
|
||||
chooser.setDialogTitle("Choisir un fichier ODF");
|
||||
|
||||
chooser.setCurrentDirectory(new java.io.File(commandes.path));
|
||||
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
||||
FileNameExtensionFilter filter = new FileNameExtensionFilter("Format ODF", "odt");
|
||||
chooser.setFileFilter(filter);
|
||||
chooser.setAcceptAllFileFilterUsed(true);
|
||||
|
||||
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
|
||||
System.out.println("getCurrentDirectory(): " + chooser.getCurrentDirectory());
|
||||
System.out.println("getSelectedFile() : " + chooser.getSelectedFile().getAbsolutePath());
|
||||
commandes.path = chooser.getCurrentDirectory().getAbsolutePath();
|
||||
commandes.PathFilenameAnalysis = chooser.getSelectedFile().getAbsolutePath();
|
||||
commandes.nameSujet = chooser.getSelectedFile().getName();
|
||||
|
||||
Run b = null;
|
||||
try {
|
||||
b = new Run(commandes.PathFilenameAnalysis);
|
||||
node nodSujet = Run.XMLContent(b.getLectDossiers().getEC().getListeContentWriter().get(0));
|
||||
nodSujet = meptl.LectureFichierEtudiantSousFormeDeNode(nodSujet,b,0);
|
||||
nodSujet.getAttributs().put("analysis_filename","sujet.xml");
|
||||
commandes.sujet = ecritureSujet.nodePourEcritureSujet(nodSujet,b,0);
|
||||
|
||||
new verificationFichierAnalyse();
|
||||
if(commandes.fichierAnalyseValide) {
|
||||
constructionTree();
|
||||
}else {
|
||||
textNodeSelect.setText("<h1>Le fichier n'est pas valise</h1>");
|
||||
}
|
||||
|
||||
} catch (ParserConfigurationException | SAXException | IOException | CloneNotSupportedException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
refeshNodeSelected();
|
||||
}
|
||||
|
||||
|
||||
commandes.ecritCode = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -1329,20 +1455,20 @@ public class create extends JFrame {
|
|||
tree.setInvokesStopCellEditing(true);
|
||||
|
||||
|
||||
if(commandes.fichierAnalyseValide) {
|
||||
if(commandes.sujet.getNomElt().equals("fichier")) {
|
||||
node0 = new DefaultMutableTreeNode(commandes.sujet.getNomElt(),true);
|
||||
|
||||
for(int i = 0 ; i < commandes.sujet.getNodes().size(); i++) {
|
||||
if(commandes.sujet!=null) for(int i = 0 ; i < commandes.sujet.getNodes().size(); i++) {
|
||||
node1 = new DefaultMutableTreeNode(commandes.sujet.getNodes().get(i));
|
||||
for(int j = 0 ; j < commandes.sujet.getNodes().get(i).getNodes().size();j++) {
|
||||
node2 = new DefaultMutableTreeNode(commandes.sujet.getNodes().get(i).getNodes().get(j));
|
||||
for(int k = 0 ; k<commandes.sujet.getNodes().get(i).getNodes().get(j).getNodes().size(); k++){
|
||||
if(commandes.sujet.getNodes().get(i)!=null) for(int j = 0 ; j < commandes.sujet.getNodes().get(i).getNodes().size();j++) {
|
||||
node2 = new DefaultMutableTreeNode(commandes.sujet.getNodes().get(i).getNodes().get(j));
|
||||
if(commandes.sujet.getNodes().get(i).getNodes().get(j)!=null) for(int k = 0 ; k<commandes.sujet.getNodes().get(i).getNodes().get(j).getNodes().size(); k++){
|
||||
node3 = new DefaultMutableTreeNode(commandes.sujet.getNodes().get(i).getNodes().get(j).getNodes().get(k));
|
||||
for(int l = 0 ; l<commandes.sujet.getNodes().get(i).getNodes().get(j).getNodes().get(k).getNodes().size(); l++){
|
||||
if(commandes.sujet.getNodes().get(i).getNodes().get(j).getNodes().get(k)!=null) for(int l = 0 ; l<commandes.sujet.getNodes().get(i).getNodes().get(j).getNodes().get(k).getNodes().size(); l++){
|
||||
node4 = new DefaultMutableTreeNode(commandes.sujet.getNodes().get(i).getNodes().get(j).getNodes().get(k).getNodes().get(l));
|
||||
for(int m = 0 ; m<commandes.sujet.getNodes().get(i).getNodes().get(j).getNodes().get(k).getNodes().get(l).getNodes().size(); m++){
|
||||
if(commandes.sujet.getNodes().get(i).getNodes().get(j).getNodes().get(k).getNodes().get(l)!=null) for(int m = 0 ; m<commandes.sujet.getNodes().get(i).getNodes().get(j).getNodes().get(k).getNodes().get(l).getNodes().size(); m++){
|
||||
node5 = new DefaultMutableTreeNode(commandes.sujet.getNodes().get(i).getNodes().get(j).getNodes().get(k).getNodes().get(l).getNodes().get(m));
|
||||
for(int n = 0 ; n<commandes.sujet.getNodes().get(i).getNodes().get(j).getNodes().get(k).getNodes().get(l).getNodes().get(m).getNodes().size(); n++){
|
||||
if(commandes.sujet.getNodes().get(i).getNodes().get(j).getNodes().get(k).getNodes().get(l).getNodes().get(m)!=null) for(int n = 0 ; n<commandes.sujet.getNodes().get(i).getNodes().get(j).getNodes().get(k).getNodes().get(l).getNodes().get(m).getNodes().size(); n++){
|
||||
node6 = new DefaultMutableTreeNode(commandes.sujet.getNodes().get(i).getNodes().get(j).getNodes().get(k).getNodes().get(l).getNodes().get(m).getNodes().get(n));
|
||||
node5.add(node6);
|
||||
}
|
||||
|
@ -1436,4 +1562,76 @@ public class create extends JFrame {
|
|||
tree.collapsePath(new TreePath(N.getPath()));
|
||||
}
|
||||
|
||||
// void saySomething(String eventDescription, TreeExpansionEvent e) {
|
||||
// System.out.println(eventDescription + "; " + "path = " + e.getPath());
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // Required by TreeExpansionListener interface.
|
||||
// public void treeExpanded(TreeExpansionEvent e) {
|
||||
// saySomething("Tree-expanded event detected", e);
|
||||
// }
|
||||
//
|
||||
// // Required by TreeExpansionListener interface.
|
||||
// public void treeCollapsed(TreeExpansionEvent e) {
|
||||
// saySomething("Tree-collapsed event detected", e);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//class MyTreeWillExpandListener implements TreeWillExpandListener {
|
||||
//
|
||||
//
|
||||
// public void treeWillExpand(TreeExpansionEvent evt) throws ExpandVetoException {
|
||||
// JTree tree = (JTree) evt.getSource();
|
||||
//
|
||||
// TreePath path = evt.getPath();
|
||||
// boolean veto = false;
|
||||
// if (veto) {
|
||||
// throw new ExpandVetoException(evt);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void treeWillCollapse(TreeExpansionEvent evt) throws ExpandVetoException {
|
||||
// JTree tree = (JTree) evt.getSource();
|
||||
//
|
||||
// TreePath path = evt.getPath();
|
||||
// boolean veto = false;
|
||||
// if (veto) {
|
||||
// throw new ExpandVetoException(evt);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//class MyTreeExpansionListener implements TreeExpansionListener {
|
||||
//
|
||||
// public ArrayList<TreePath> Chemin = new ArrayList<TreePath>();
|
||||
//
|
||||
// public ArrayList<TreePath> getChemin() {
|
||||
// return Chemin;
|
||||
// }
|
||||
//
|
||||
// public void setChemin(ArrayList<TreePath> chemin) {
|
||||
// Chemin = chemin;
|
||||
// }
|
||||
//
|
||||
// public void treeExpanded(TreeExpansionEvent evt) {
|
||||
// TreePath path = evt.getPath();
|
||||
// Chemin.add(path);
|
||||
// System.out.println("treeExpanded");
|
||||
// }
|
||||
//
|
||||
// public void treeCollapsed(TreeExpansionEvent evt) {
|
||||
// TreePath path = evt.getPath();
|
||||
// Chemin.remove(path);
|
||||
// System.out.println("treeCollapsed");
|
||||
//
|
||||
// }
|
||||
//}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ public class filechooserXML extends JFileChooser {
|
|||
|
||||
int response = showOpenDialog(null);
|
||||
if(response == JFileChooser.APPROVE_OPTION) {
|
||||
commandes.message = new StringBuilder();
|
||||
|
||||
File file = new File(getSelectedFile().getAbsolutePath());
|
||||
System.out.println(file.getPath() + "\n" + file.getName());
|
||||
|
@ -92,11 +93,7 @@ public class filechooserXML extends JFileChooser {
|
|||
new verificationFichierAnalyse();
|
||||
|
||||
|
||||
if(commandes.fichierAnalyseValide) {
|
||||
// Run.parentAndLevel(commandes.sujet, commandes.sujet.getNomElt(), 0);
|
||||
// create.setTree();
|
||||
}
|
||||
|
||||
|
||||
// Affiche les erreurs dans une message box
|
||||
//if(!commandes.fichierAnalyseValide) JOptionPane.showMessageDialog(null, verificationFichierAnalyse.messageErreur.toString());
|
||||
|
||||
|
|
|
@ -0,0 +1,314 @@
|
|||
package app;
|
||||
|
||||
import java.awt.EventQueue;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JLabel;
|
||||
import java.awt.Font;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
|
||||
import MEPTL.commandes;
|
||||
|
||||
|
||||
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 java.awt.Toolkit;
|
||||
|
||||
public 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 JComboBox<String> comboBoxPresenceMetaSujet;
|
||||
private JComboBox<String> comboBoxBaremeABC;
|
||||
private JComboBox<String> comboBoxhistoriquePresent;
|
||||
private JComboBox<String> comboBoxcontrole_Initial_Creator;
|
||||
private JComboBox<String> comboBoxcontroleDateCreation;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* Launch the application.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
proprieteFichierAnalyse frame = new proprieteFichierAnalyse();
|
||||
frame.setVisible(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the frame.
|
||||
*/
|
||||
public proprieteFichierAnalyse() {
|
||||
setIconImage(Toolkit.getDefaultToolkit().getImage(proprieteFichierAnalyse.class.getResource("/resources/evalwriter.ico")));
|
||||
setBounds(0, 0, 600, 560);
|
||||
setResizable(false);
|
||||
setTitle("Propriété du fichier d'analyse");
|
||||
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]", "[18px][18px][18px][30px][18px][18px][18px][30px][45px][18px][18px][18px][][][][][]"));
|
||||
|
||||
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"));
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
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"));
|
||||
}
|
||||
|
||||
JLabel lblNewLabel_3 = new JLabel("<HTML><p>Propriété personnalisé obligatoire dans les <br>fichiers des étudiants.</p></HTML>" );
|
||||
lblNewLabel_3.setFont(new Font("Tahoma", Font.PLAIN, 12));
|
||||
contentPane.add(lblNewLabel_3, "cell 0 3,alignx left,aligny center");
|
||||
|
||||
comboBoxPresenceMetaSujet = new JComboBox<String>();
|
||||
comboBoxPresenceMetaSujet.setFont(new Font("Tahoma", Font.BOLD, 12));
|
||||
comboBoxPresenceMetaSujet.setModel(new DefaultComboBoxModel<String>(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());
|
||||
}
|
||||
|
||||
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<String>();
|
||||
comboBoxBaremeABC.setModel(new DefaultComboBoxModel<String>(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());
|
||||
}
|
||||
|
||||
|
||||
|
||||
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"));
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
|
||||
JLabel lblNewLabel_6 = new JLabel("<html>Le suivi des modifications activé dans les <br>fichiers des étudiants.</html>");
|
||||
lblNewLabel_6.setFont(new Font("Tahoma", Font.PLAIN, 12));
|
||||
contentPane.add(lblNewLabel_6, "cell 0 7,alignx left");
|
||||
|
||||
comboBoxhistoriquePresent = new JComboBox<String>();
|
||||
comboBoxhistoriquePresent.setModel(new DefaultComboBoxModel<String>(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());
|
||||
}
|
||||
|
||||
|
||||
JLabel lblNewLabel_7 = new JLabel("<html>Date de création du fichier transmis <br>aux étudiants.</html>");
|
||||
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"));
|
||||
}
|
||||
|
||||
lblNewLabel_8 = new JLabel("<html>La date de création dans les fichers des étudiants doit être le même que celui du fichier fourni.</html>");
|
||||
lblNewLabel_8.setFont(new Font("Tahoma", Font.PLAIN, 12));
|
||||
contentPane.add(lblNewLabel_8, "cell 0 9,alignx trailing");
|
||||
|
||||
comboBoxcontroleDateCreation = new JComboBox<String>();
|
||||
comboBoxcontroleDateCreation.setModel(new DefaultComboBoxModel<String>(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());
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
|
||||
lblNewLabel_10 = new JLabel("<html>L'auteur des fichiers des étudiants doit être celui du fichier fourni.</html>");
|
||||
lblNewLabel_10.setFont(new Font("Tahoma", Font.PLAIN, 12));
|
||||
contentPane.add(lblNewLabel_10, "cell 0 11,alignx trailing");
|
||||
|
||||
comboBoxcontrole_Initial_Creator = new JComboBox<String>();
|
||||
comboBoxcontrole_Initial_Creator.setModel(new DefaultComboBoxModel<String>(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());
|
||||
}
|
||||
|
||||
lblNewLabel_11 = new JLabel("Lien URL de l'aide");
|
||||
lblNewLabel_11.setFont(new Font("Tahoma", Font.PLAIN, 12));
|
||||
contentPane.add(lblNewLabel_11, "cell 0 12,alignx left");
|
||||
|
||||
textFieldlink_help = new JTextField();
|
||||
textFieldlink_help.setFont(new Font("Tahoma", Font.PLAIN, 12));
|
||||
contentPane.add(textFieldlink_help, "cell 1 12,growx");
|
||||
textFieldlink_help.setColumns(10);
|
||||
if(commandes.sujet.getAttributs().get("link_help")!=null){
|
||||
textFieldlink_help.setText(commandes.sujet.getAttributs().get("link_help"));
|
||||
}
|
||||
|
||||
lblNewLabel_12 = new JLabel("Lien URL du sujet");
|
||||
lblNewLabel_12.setFont(new Font("Tahoma", Font.PLAIN, 12));
|
||||
contentPane.add(lblNewLabel_12, "cell 0 13,alignx left");
|
||||
|
||||
textFieldlink_sujet = new JTextField();
|
||||
contentPane.add(textFieldlink_sujet, "cell 1 13,growx");
|
||||
textFieldlink_sujet.setColumns(10);
|
||||
if(commandes.sujet.getAttributs().get("link_sujet")!=null){
|
||||
textFieldlink_sujet.setText(commandes.sujet.getAttributs().get("link_sujet"));
|
||||
}
|
||||
|
||||
JButton btnNewButton = new JButton("Valide");
|
||||
btnNewButton.setFont(new Font("Tahoma", Font.PLAIN, 12));
|
||||
contentPane.add(btnNewButton, "cell 1 16,growx,aligny top");
|
||||
btnNewButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
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("controleDateCreation", comboBoxcontroleDateCreation.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() );
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Refresh();
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
private void Refresh() {
|
||||
|
||||
|
||||
|
||||
if(comboBoxBaremeABC.getSelectedItem().equals("true")) {
|
||||
textFieldNoteFrom.setEditable(false);
|
||||
textFieldNoteFrom.setEditable(false);
|
||||
}else {
|
||||
textFieldNoteFrom.setEditable(true);
|
||||
textFieldNoteFrom.setEditable(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue