diff --git a/bin/.gitignore b/bin/.gitignore index 3d4bed4..50f4061 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -529,3 +529,7 @@ /zipstudent.svg /zipstudentmini.png /resources/ +/EvalTabDefautStyleLeaderfalse.png +/EvalTabDefautStyleLeaderfalsemini.png +/EvalTabDefautStyleLeadertrue.png +/EvalTabDefautStyleLeadertruemini.png diff --git a/icons/EvalTabDefautStyleLeaderfalse.png b/icons/EvalTabDefautStyleLeaderfalse.png new file mode 100644 index 0000000..1482d65 Binary files /dev/null and b/icons/EvalTabDefautStyleLeaderfalse.png differ diff --git a/icons/EvalTabDefautStyleLeaderfalsemini.png b/icons/EvalTabDefautStyleLeaderfalsemini.png new file mode 100644 index 0000000..ebb47dc Binary files /dev/null and b/icons/EvalTabDefautStyleLeaderfalsemini.png differ diff --git a/icons/EvalTabDefautStyleLeadertrue.png b/icons/EvalTabDefautStyleLeadertrue.png new file mode 100644 index 0000000..dc6bf18 Binary files /dev/null and b/icons/EvalTabDefautStyleLeadertrue.png differ diff --git a/icons/EvalTabDefautStyleLeadertruemini.png b/icons/EvalTabDefautStyleLeadertruemini.png new file mode 100644 index 0000000..52ec5f1 Binary files /dev/null and b/icons/EvalTabDefautStyleLeadertruemini.png differ diff --git a/icons/supprimeAttribut.png b/icons/supprimeAttribut.png new file mode 100644 index 0000000..ec1becb Binary files /dev/null and b/icons/supprimeAttribut.png differ diff --git a/icons/supprimeAttribut.svg b/icons/supprimeAttribut.svg new file mode 100644 index 0000000..5cfa5df --- /dev/null +++ b/icons/supprimeAttribut.svg @@ -0,0 +1,52 @@ + + + + + + + + + + diff --git a/icons/supprimeAttributmini.png b/icons/supprimeAttributmini.png new file mode 100644 index 0000000..9198ac5 Binary files /dev/null and b/icons/supprimeAttributmini.png differ diff --git a/src/action/actEvalFormatageDirectTousLesNodesTrue.java b/src/action/actEvalFormatageDirectTousLesNodesTrue.java index 77fb847..cf2ba2d 100644 --- a/src/action/actEvalFormatageDirectTousLesNodesTrue.java +++ b/src/action/actEvalFormatageDirectTousLesNodesTrue.java @@ -34,22 +34,21 @@ public class actEvalFormatageDirectTousLesNodesTrue extends AbstractAction{ String a = JOptionPane.showInputDialog(null,"Quel est le nombre de point?",point); - if(!a.isEmpty()) { + if(a!=null)if(!a.isEmpty()) { try { point = Integer.valueOf(a); if(point<=0) { - nod.getAttributs().put("evalFormatageDirect", String.valueOf(0)); + nod.supprimeAttribut("evalFormatageDirect"); fenetres.create.getTextNodeSelect().setText(baliseStyle.balise()); - fenetres.create.getTextNodeSelect().setText("

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

"); + fenetres.create.getTextNodeSelect().setText("

Erreur la valeur doit être un nombre entier POSITIF SUPÉRIEUR à zéro.
Cependant,l'attribut evalFormatageDirect a été supprimé.

"); }else { - String pointString = String.valueOf(point); if(nod.getNomElt().equals("page")) { - ajouteAttribut(nod,pointString); + ajouteAttribut(nod,point); } if(nod.getNomElt().equals("structurepage")) { for(int i = 0 ; i < nod.getNodes().size(); i++) { if(nod.getNodes().get(i).getNomElt().equals("page")) { - ajouteAttribut(nod.getNodes().get(i),pointString); + ajouteAttribut(nod.getNodes().get(i),point); } } } @@ -63,10 +62,14 @@ public class actEvalFormatageDirectTousLesNodesTrue extends AbstractAction{ } - private void ajouteAttribut(node nodePage, String pointString) { + private void ajouteAttribut(node nodePage, Integer point) { for(int i = 0 ; i < nodePage.getNodes().size(); i++) { if(listeDesNodesAnalyseStyle.isAnalyseStyle(nodePage.getNodes().get(i))) { - nodePage.getNodes().get(i).getAttributs().put("evalFormatageDirect", pointString); + if(point>0) { + nodePage.getNodes().get(i).getAttributs().put("evalFormatageDirect", String.valueOf(point)); + }else { + nodePage.getNodes().get(i).supprimeAttribut("evalFormatageDirect"); + } } } } diff --git a/src/fenetres/attributs.java b/src/fenetres/attributs.java index 09301b0..719f6f0 100644 --- a/src/fenetres/attributs.java +++ b/src/fenetres/attributs.java @@ -42,7 +42,9 @@ public class attributs extends JFrame { */ private static final long serialVersionUID = 1L; private JPanel contentPane; + JScrollPane scrollPaneCentre = new JScrollPane(); private JPanel panelCentre = new JPanel(); + JButton btnValide = new JButton("Valider les modifications"); node nod; afficheText J; int indexSelect=0; @@ -52,6 +54,9 @@ public class attributs extends JFrame { ArrayList Lesevaluer = new ArrayList(); ArrayList Lespoints = new ArrayList(); ArrayList KeysAttribut = new ArrayList(); + ArrayList KeysRemove = new ArrayList(); + ArrayList LesBoutonsSuppr = new ArrayList(); + /** * Create the frame. */ @@ -99,18 +104,54 @@ public class attributs extends JFrame { btnAddAttribut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String nameAttribut=""; - nameAttribut = JOptionPane.showInputDialog(null,"Quelle est la clé de l'attribut ?",""); + nameAttribut = JOptionPane.showInputDialog(null,"Quel est le nom de l'attribut ?",""); if(nameAttribut!=null)if(!nameAttribut.isBlank()) { - nod.getAttributs().put(nameAttribut, ""); + nameAttribut = nameAttribut.replaceAll("\\s+", ""); + + String key = nameAttribut; + JTextField txtFielPoints = new JTextField("0"); + JTextField txtFielValue = new JTextField(""); + JLabel lbKeys = new JLabel(nameAttribut); + JCheckBox checkEval = new JCheckBox(); + txtFielValue.addMouseListener(new MyMouseListener()); + txtFielPoints.setColumns(3); + checkEval.setSelected(false); + + Leslabels.add(lbKeys); + Lesvaleurs.add(txtFielValue); + Lespoints.add(txtFielPoints); + Lesevaluer.add(checkEval); + KeysAttribut.add(nameAttribut); + + JButton Btn = new JButton(""); + Btn.setIcon(new ImageIcon(create.class.getResource("/resources/supprimeAttributmini.png"))); + LesBoutonsSuppr.add(Btn); + Btn.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Leslabels.remove(lbKeys); + Lespoints.remove(txtFielPoints); + Lesvaleurs.remove(txtFielValue); + Lesevaluer.remove(checkEval); + LesBoutonsSuppr.remove(Btn); + KeysAttribut.remove(key); + KeysRemove.add(key); + + panelCentre.removeAll(); + refresh(); + } + }); + + panelCentre.removeAll(); refresh(); } } }); + panelBas.add(btnAddAttribut); panelBas.add(btnNewButton); - JButton btnValide = new JButton("Valider les modifications"); + btnValide = new JButton("Valider les modifications"); btnValide.setFont(new Font("Tahoma", Font.BOLD, 12)); btnValide.setForeground(Color.RED); panelBas.add(btnValide); @@ -221,29 +262,30 @@ public class attributs extends JFrame { btnTouText.setToolTipText("N'importe quel texte mais pas null, ou pas la valeur none ou pas vide.
Toutes les autres fonctions sont ignorées."); panelDroite.add(btnTouText); - JScrollPane scrollPaneCentre = new JScrollPane(); contentPane.add(scrollPaneCentre, BorderLayout.CENTER); - scrollPaneCentre.setViewportView(panelCentre); - panelCentre.setLayout(new MigLayout("gap rel 0", "[100px:n,grow][150px:n,grow 150][::80px][80px:n]", - "[::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px]")); + panelCentre.setLayout(new MigLayout("gap rel 0", "[20px:n,fill][100px:n,grow][100px:n,grow][32px:n][32px:n]", "[::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px][::20px]")); + + JLabel lblNewLabel0 = new JLabel("Supprime"); + lblNewLabel0.setFont(new Font("Tahoma", Font.BOLD, 11)); + panelCentre.add(lblNewLabel0, "cell 0 0"); JLabel lblNewLabel = new JLabel("Nom attribut"); lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 11)); - panelCentre.add(lblNewLabel, "cell 0 0"); + panelCentre.add(lblNewLabel, "cell 1 0"); JLabel lblNewLabel_1 = new JLabel("Valeurs"); lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 11)); - panelCentre.add(lblNewLabel_1, "flowx,cell 1 0"); + panelCentre.add(lblNewLabel_1, "flowx,cell 2 0"); JLabel lblNewLabel_2 = new JLabel("Evaluer"); lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 11)); - panelCentre.add(lblNewLabel_2, "cell 2 0"); + panelCentre.add(lblNewLabel_2, "cell 3 0"); JLabel lblNewLabel_3 = new JLabel("Point(s)"); lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 11)); - panelCentre.add(lblNewLabel_3, "cell 3 0,alignx left"); + panelCentre.add(lblNewLabel_3, "cell 4 0,alignx left"); Enumeration key = nod.getAttributs().keys(); @@ -269,29 +311,51 @@ public class attributs extends JFrame { JTextField txtFielPoints = new JTextField(point); JTextField txtFielValue = new JTextField(value); + JLabel lbKeys = new JLabel(k); + txtFielValue.addMouseListener(new MyMouseListener()); txtFielPoints.setColumns(3); checkEval.setSelected(evaluer); - Leslabels.add(new JLabel(k)); + Leslabels.add(lbKeys); Lesvaleurs.add(txtFielValue); Lespoints.add(txtFielPoints); Lesevaluer.add(checkEval); KeysAttribut.add(k); + JButton Btn = new JButton(""); + Btn.setIcon(new ImageIcon(create.class.getResource("/resources/supprimeAttributmini.png"))); + LesBoutonsSuppr.add(Btn); + Btn.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Leslabels.remove(lbKeys); + Lespoints.remove(txtFielPoints); + Lesvaleurs.remove(txtFielValue); + Lesevaluer.remove(checkEval); + LesBoutonsSuppr.remove(Btn); + KeysAttribut.remove(k); + KeysRemove.add(k); + + panelCentre.removeAll(); + refresh(); + } + }); + + + + } } - - //Placement dans le panel des informations for(int i = 0 ; i key = nod.getAttributs().keys(); - while(key.hasMoreElements()) { - - String k = key.nextElement(); - if(!listeAttributsAnalyseWriter.isAttributAnalyseWriter(k)) { - String value = nod.getAttributs().get(k); - String point = "0"; - JCheckBox checkEval = new JCheckBox(); - boolean evaluer = false; - if(value.contains("‽")||value.contains("‼")) { - evaluer=true; - if(value.contains("‽")) { - point = value.substring(value.lastIndexOf("‽")+1,value.length()); - value = value.substring(0,value.lastIndexOf("‽")); - } - if(value.contains("‼")) { - point = value.substring(value.lastIndexOf("‼")+1,value.length()); - value = value.substring(0,value.lastIndexOf("‼")); - } - } - - JTextField txtFielPoints = new JTextField(point); - JTextField txtFielValue = new JTextField(value); - txtFielValue.addMouseListener(new MyMouseListener()); - txtFielPoints.setColumns(3); - checkEval.setSelected(evaluer); - - if(!KeysAttribut.contains(k)) { - Leslabels.add(new JLabel(k)); - Lesvaleurs.add(txtFielValue); - Lespoints.add(txtFielPoints); - Lesevaluer.add(checkEval); - KeysAttribut.add(k); - } - - } - } + + JLabel lblNewLabel0 = new JLabel("Supprime"); + lblNewLabel0.setFont(new Font("Tahoma", Font.BOLD, 11)); + panelCentre.add(lblNewLabel0, "cell 0 0"); + JLabel lblNewLabel = new JLabel("Nom attribut"); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 11)); + panelCentre.add(lblNewLabel, "cell 1 0"); + JLabel lblNewLabel_1 = new JLabel("Valeurs"); + lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 11)); + panelCentre.add(lblNewLabel_1, "flowx,cell 2 0"); + + JLabel lblNewLabel_2 = new JLabel("Evaluer"); + lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 11)); + panelCentre.add(lblNewLabel_2, "cell 3 0"); + + JLabel lblNewLabel_3 = new JLabel("Point(s)"); + lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 11)); + panelCentre.add(lblNewLabel_3, "cell 4 0,alignx left"); + //Placement dans le panel des informations - for(int i = 0 ; i