diff --git a/.classpath b/.classpath index 2678748..df2dd8b 100644 --- a/.classpath +++ b/.classpath @@ -5,7 +5,7 @@ - + diff --git a/analyseWriter.jar b/analyseWriter.jar index 04d75ac..26b2038 100644 Binary files a/analyseWriter.jar and b/analyseWriter.jar differ diff --git a/bin/.gitignore b/bin/.gitignore index f13ae4e..75cdbd6 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -1 +1,2 @@ /app/ +/resources/ diff --git a/bin/app/create$1.class b/bin/app/create$1.class index 9a263d3..b22c265 100644 Binary files a/bin/app/create$1.class and b/bin/app/create$1.class differ diff --git a/bin/app/create$10.class b/bin/app/create$10.class index 676dbc8..6d8cb8a 100644 Binary files a/bin/app/create$10.class and b/bin/app/create$10.class differ diff --git a/bin/app/create$11.class b/bin/app/create$11.class index dbe69be..b30f641 100644 Binary files a/bin/app/create$11.class and b/bin/app/create$11.class differ diff --git a/bin/app/create$12.class b/bin/app/create$12.class index c46809e..9497ff9 100644 Binary files a/bin/app/create$12.class and b/bin/app/create$12.class differ diff --git a/bin/app/create$13.class b/bin/app/create$13.class index d1f85e5..3426d18 100644 Binary files a/bin/app/create$13.class and b/bin/app/create$13.class differ diff --git a/bin/app/create$14.class b/bin/app/create$14.class index edfe407..acf0523 100644 Binary files a/bin/app/create$14.class and b/bin/app/create$14.class differ diff --git a/bin/app/create$15.class b/bin/app/create$15.class index a7e23ec..117173a 100644 Binary files a/bin/app/create$15.class and b/bin/app/create$15.class differ diff --git a/bin/app/create$16.class b/bin/app/create$16.class index cc0250c..7654d2d 100644 Binary files a/bin/app/create$16.class and b/bin/app/create$16.class differ diff --git a/bin/app/create$17.class b/bin/app/create$17.class index 5c62f67..4ad486c 100644 Binary files a/bin/app/create$17.class and b/bin/app/create$17.class differ diff --git a/bin/app/create$18.class b/bin/app/create$18.class index d4350ce..7b413b0 100644 Binary files a/bin/app/create$18.class and b/bin/app/create$18.class differ diff --git a/bin/app/create$19.class b/bin/app/create$19.class index 3757b84..5c5b497 100644 Binary files a/bin/app/create$19.class and b/bin/app/create$19.class differ diff --git a/bin/app/create$2.class b/bin/app/create$2.class index 90636f5..83d976a 100644 Binary files a/bin/app/create$2.class and b/bin/app/create$2.class differ diff --git a/bin/app/create$20.class b/bin/app/create$20.class index c36172b..71ed88d 100644 Binary files a/bin/app/create$20.class and b/bin/app/create$20.class differ diff --git a/bin/app/create$21.class b/bin/app/create$21.class index 8cc8995..2c4f1a1 100644 Binary files a/bin/app/create$21.class and b/bin/app/create$21.class differ diff --git a/bin/app/create$22.class b/bin/app/create$22.class index bf37b41..2c7cc73 100644 Binary files a/bin/app/create$22.class and b/bin/app/create$22.class differ diff --git a/bin/app/create$23.class b/bin/app/create$23.class index 4aea0f2..9bbd2c3 100644 Binary files a/bin/app/create$23.class and b/bin/app/create$23.class differ diff --git a/bin/app/create$3.class b/bin/app/create$3.class index 2464b64..d46faad 100644 Binary files a/bin/app/create$3.class and b/bin/app/create$3.class differ diff --git a/bin/app/create$4.class b/bin/app/create$4.class index 6ccab71..215e479 100644 Binary files a/bin/app/create$4.class and b/bin/app/create$4.class differ diff --git a/bin/app/create$5.class b/bin/app/create$5.class index c0ed04a..7292541 100644 Binary files a/bin/app/create$5.class and b/bin/app/create$5.class differ diff --git a/bin/app/create$6.class b/bin/app/create$6.class index fe6d2d6..0b693f0 100644 Binary files a/bin/app/create$6.class and b/bin/app/create$6.class differ diff --git a/bin/app/create$7.class b/bin/app/create$7.class index 44995b9..26825a3 100644 Binary files a/bin/app/create$7.class and b/bin/app/create$7.class differ diff --git a/bin/app/create$8.class b/bin/app/create$8.class index 0adae23..058c38d 100644 Binary files a/bin/app/create$8.class and b/bin/app/create$8.class differ diff --git a/bin/app/create$9.class b/bin/app/create$9.class index 61def74..f631585 100644 Binary files a/bin/app/create$9.class and b/bin/app/create$9.class differ diff --git a/bin/app/create.class b/bin/app/create.class index 4f3c04c..cb004d5 100644 Binary files a/bin/app/create.class and b/bin/app/create.class differ diff --git a/icons/poids.svg b/icons/poids.svg new file mode 100644 index 0000000..f901afb --- /dev/null +++ b/icons/poids.svg @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/icons/poidsmini.png b/icons/poidsmini.png new file mode 100644 index 0000000..899fcf8 Binary files /dev/null and b/icons/poidsmini.png differ diff --git a/src/app/create.java b/src/app/create.java index 69a06a8..5f2fc8e 100644 --- a/src/app/create.java +++ b/src/app/create.java @@ -170,12 +170,12 @@ public class create extends JFrame { tree.setVisibleRowCount(30); // Ajoute le menu contextuel de la tree - tree.setComponentPopupMenu(createPopupMenuTree()); + tree.setComponentPopupMenu(null); // Construction et injection de la barre d'outils JPanel contentPane = (JPanel) getContentPane(); this.createToolBar(); - this.createPopupMenuTree(); + this.createPopupMenuTree(null); getContentPane().setLayout(new BorderLayout(2, 2)); contentPane.add( toolBar, BorderLayout.NORTH ); @@ -493,14 +493,10 @@ public class create extends JFrame { StringBuilder sb = new StringBuilder(); - sb.append(balisestyles()); - - + sb.append("

Parent = " + nodeParent.getNomElt() + "


"); - sb.append("
"); - sb.append("

Nom du node : " + nod.getNomElt() + "


"); sb.append("
"); @@ -509,34 +505,39 @@ public class create extends JFrame { sb.append("
    "); while(key.hasMoreElements()) { String k = key.nextElement(); - boolean ecrit =false; +// boolean ecrit =false; if(nod.getAttributs().get("evaluer")!=null) { if(nod.getAttributs().get("evaluer").equals("true")) { - switch(k) { - case ("evalContenu"): - sb.append("
  • " + k + "=\"" + nod.getAttributs().get(k)+"\"
  • "); - ecrit=true; - break; - case("evaluer"): - sb.append("
  • " + k + "=\"" + nod.getAttributs().get(k)+"\"
  • "); - ecrit=true; - break; - } - - if(nod.getAttributs().get(k).contains("‽") && !ecrit) { - sb.append("
  • " + k + "=\"" + nod.getAttributs().get(k)+"\"
  • "); - ecrit=true; - }else { - sb.append("
  • " + k + "=\"" + nod.getAttributs().get(k)+"\"
  • "); - ecrit=true; - } + sb.append("
  • " + k + "=\"" + nod.getAttributs().get(k)+"\"
  • "); + +// switch(k) { +// case ("evalContenu"): +// sb.append("
  • " + k + "=\"" + nod.getAttributs().get(k)+"\"
  • "); +// ecrit=true; +// break; +// case("evaluer"): +// sb.append("
  • " + k + "=\"" + nod.getAttributs().get(k)+"\"
  • "); +// ecrit=true; +// break; +// } +// +// if(nod.getAttributs().get(k).contains("‽") && !ecrit) { +// sb.append("
  • " + k + "=\"" + nod.getAttributs().get(k)+"\"
  • "); +// ecrit=true; +// }else { +// sb.append("
  • " + k + "=\"" + nod.getAttributs().get(k)+"\"
  • "); +// ecrit=true; +// } }else { sb.append("
  • " + k + "=\"" + nod.getAttributs().get(k)+"\"
  • "); if(nod.getAttributs().get(k).contains("‽")) sb.append("
  • " + k + "=\"" + nod.getAttributs().get(k)+"\"
  • "); } - }else { + } + + + if(nod.getAttributs().get("evaluer")==null) { sb.append("
  • " + k + "=\"" + nod.getAttributs().get(k)+"\"
  • "); } @@ -549,6 +550,8 @@ public class create extends JFrame { } textNodeSelect.setText(""+sb.toString()+""); + + createPopupMenuTree(nod); } } @@ -558,37 +561,62 @@ public class create extends JFrame { * Création du menu contextuel du tree * @return */ - private JPopupMenu createPopupMenuTree() { + private void createPopupMenuTree(node nod) { + if(nod!=null) { + JMenu mnEvaluer = new JMenu("Evaluer"); + mnEvaluer.add(actEvalueTrue); + mnEvaluer.add(actEvalueFalse); + + JMenu mnManageTree = new JMenu("Arbre"); + mnManageTree.add(actExpandAll); + mnManageTree.add(actExpandNode); + mnManageTree.addSeparator(); + mnManageTree.add(actCollapseAll); + mnManageTree.add(actCollapseNode); + + JMenu mnNodePrincipal = new JMenu("Node niveau 1"); + mnNodePrincipal.add(actCoefficient); + mnNodePrincipal.addSeparator(); + mnNodePrincipal.add("Insère une ligne avant le titre"); + mnNodePrincipal.addSeparator(); + mnNodePrincipal.add("Ajoute un Titre principal"); + mnNodePrincipal.add("Ajoute un Titre 1"); + mnNodePrincipal.add("Ajoute un Titre 2"); + mnNodePrincipal.add("Ajoute un Titre 3"); + + + JPopupMenu mnPopupTree = new JPopupMenu(); + mnPopupTree.add(mnEvaluer); + if(nod.getLevel()==1) { + mnPopupTree.addSeparator(); + mnPopupTree.add(mnNodePrincipal); + } + mnPopupTree.addSeparator(); + mnPopupTree.add(actNodeFichier); + mnPopupTree.addSeparator(); + mnPopupTree.add(mnManageTree); + mnPopupTree.addSeparator(); + mnPopupTree.add(actDelete); - JMenu mnEvaluer = new JMenu("Evaluer"); - mnEvaluer.add(actEvalueTrue); - mnEvaluer.add(actEvalueFalse); + + tree.setComponentPopupMenu(mnPopupTree); + }else { + + JMenu mnManageTree = new JMenu("Arbre"); + mnManageTree.add(actExpandAll); + mnManageTree.add(actExpandNode); + mnManageTree.addSeparator(); + mnManageTree.add(actCollapseAll); + mnManageTree.add(actCollapseNode); + + JPopupMenu mnPopupTree = new JPopupMenu(); + mnPopupTree.add(mnManageTree); + + tree.setComponentPopupMenu(mnPopupTree); + } - JMenu mnManageTree = new JMenu("Arbre"); - mnManageTree.add(actExpandAll); - mnManageTree.add(actExpandNode); - mnManageTree.addSeparator(); - 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(mnEvaluer); - mnPopupTree.addSeparator(); - mnPopupTree.add(mnNiveauPrincipal); - mnPopupTree.addSeparator(); - mnPopupTree.add(actNodeFichier); - mnPopupTree.addSeparator(); - mnPopupTree.add(mnManageTree); - mnPopupTree.addSeparator(); - mnPopupTree.add(actDelete); - - - return mnPopupTree; } @@ -709,18 +737,7 @@ public class create extends JFrame { // } } - /*Mise à jour de la toolbar*/ - private void MAJToolBar() { -// if(commandes.fichierAnalyseValide) { -// toolBar.getComponent(6).setEnabled(true); -// toolBar.getComponent(7).setEnabled(true); -// menuBar.getComponent(3).setEnabled(true); -// }else { -// toolBar.getComponent(6).setEnabled(false); -// toolBar.getComponent(7).setEnabled(false); -// menuBar.getComponent(3).setEnabled(false); -// } - } + @@ -744,11 +761,9 @@ public class create extends JFrame { if(commandes.fichierAnalyseValide) { 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" ); } @@ -1035,6 +1050,53 @@ public class create extends JFrame { System.out.println( "Cut" ); } }; + + + /** + * + */ + private AbstractAction actCoefficient = new AbstractAction() { + + private static final long serialVersionUID = 1L; + + { + putValue( Action.NAME, "Coefficient (poids)" ); + putValue( Action.SMALL_ICON, new ImageIcon(create.class.getResource("/resources/poidsmini.png")) ); + putValue( Action.SHORT_DESCRIPTION, "Coefficient (poids)" ); + } + + @Override public void actionPerformed( ActionEvent e ) { + DefaultMutableTreeNode selectNode = (DefaultMutableTreeNode) tree.getSelectionPath().getLastPathComponent(); + + node nod = (node) selectNode.getUserObject(); + int poids = 1; + if(nod.getAttributs().get("poids")!=null) { + poids = Integer.valueOf(nod.getAttributs().get("poids")); + } + + + String a = JOptionPane.showInputDialog(null,"Quel est le coefficient de cette partie de l'évaluation?",poids); + + if(!a.isEmpty()) { + try { + poids = Integer.valueOf(a); + if(poids<=0) { + nod.poids(Integer.valueOf(1)); + textNodeSelect.setText(balisestyles()); + textNodeSelect.setText("

    Erreur la valeur doit être un nombre entier POSITIF supérieur à zéro.
    Cependant,la valeur a été modifiée.
    poids=1.

    "); + }else { + nod.poids(Integer.valueOf(poids)); + refeshNodeSelected(); + } + } catch (Exception e2) { + textNodeSelect.setText(balisestyles()); + textNodeSelect.setText("

    Erreur la valeur doit être un nombre entier.
    La valeur n'a pas été modifiée.

    "); + } + } + + } + }; + /** * @@ -1129,33 +1191,27 @@ public class create extends JFrame { } @Override public void actionPerformed( ActionEvent e ) { -// TreePath p = tree.getSelectionPath(); -// int level = p.getPathCount(); - + DefaultMutableTreeNode selectNode = (DefaultMutableTreeNode) tree.getSelectionPath().getLastPathComponent(); textNodeSelect.setContentType("text/html"); node nod = (node) selectNode.getUserObject(); - nod.evaluerTrue(); - refeshNodeSelected(); + TreeNode[] chemin = selectNode.getPath(); + boolean avertissement=false; + for(int i = 0 ; i < chemin.length; i++) { + if(chemin[i].toString().contains("setting")) avertissement = true; + System.out.println(chemin[i].toString()); + } -// tree.setModel(commandes.tree.getModel()) ; -// constructionTree(); - -// try { -// expandOrCollapsePath(tree,p,level,1,true); -// }catch(Exception e1) { -// e1.printStackTrace(); -// //do nothing -// } - - - - -// System.out.println(p.toString()); -// System.out.println(tree.getExpandsSelectedPaths()); -// tree.setSelectionPath(p); -// tree.expandPath(p); + if(!avertissement) { + nod.evaluerTrue(); + if(nod.getLevel()==1) { + nod.addMenu(true); + } + refeshNodeSelected(); + }else { + JOptionPane.showMessageDialog(null, "Ce node ne peut pas être évaluer." ); + } } }; @@ -1513,6 +1569,7 @@ public class create extends JFrame { private static String balisestyles() { return "