MAJ V4.5.0

Permet de udpprimer ou d'ajouter un attribut au node.
This commit is contained in:
pablo rodriguez 2024-04-15 11:21:19 +02:00
parent 833f47c2f5
commit 2c7837f84d
11 changed files with 189 additions and 73 deletions

4
bin/.gitignore vendored
View File

@ -529,3 +529,7 @@
/zipstudent.svg
/zipstudentmini.png
/resources/
/EvalTabDefautStyleLeaderfalse.png
/EvalTabDefautStyleLeaderfalsemini.png
/EvalTabDefautStyleLeadertrue.png
/EvalTabDefautStyleLeadertruemini.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
icons/supprimeAttribut.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="20"
height="12"
viewBox="0 0 5.2916666 3.1749999"
version="1.1"
id="svg1"
inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
sodipodi:docname="supprimeAttribut.svg"
inkscape:export-filename="supprimeAttributmini.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="39.555556"
inkscape:cx="9"
inkscape:cy="9"
inkscape:window-width="1920"
inkscape:window-height="1009"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs1" />
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#ff0000;stroke:#ff0000;stroke-width:0.321348;stroke-linecap:round;stroke-linejoin:bevel"
id="rect1"
width="4.2832508"
height="1.1862882"
x="0.50420791"
y="0.99435586" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

View File

@ -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("<h2>Erreur la valeur doit être un nombre entier POSITIF supérieur à zéro.<br>Cependant,la valeur a été modifiée.<br>evalFormatageDirect=0.</h2>");
fenetres.create.getTextNodeSelect().setText("<h2>Erreur la valeur doit être un nombre entier POSITIF SUPÉRIEUR à zéro.<br>Cependant,l'attribut <b>evalFormatageDirect</b> a été supprimé.</h2>");
}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");
}
}
}
}

View File

@ -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<JCheckBox> Lesevaluer = new ArrayList<JCheckBox>();
ArrayList<JTextField> Lespoints = new ArrayList<JTextField>();
ArrayList<String> KeysAttribut = new ArrayList<String>();
ArrayList<String> KeysRemove = new ArrayList<String>();
ArrayList<JButton> LesBoutonsSuppr = new ArrayList<JButton>();
/**
* 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("<html>N'importe quel texte mais pas null, ou pas la valeur none ou pas vide.<br>Toutes les autres fonctions sont ignorées.</html>");
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<String> 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<Leslabels.size();i++) {
Leslabels.get(i).setFont(new Font("Tahoma", Font.BOLD, 11));
Lesvaleurs.get(i).setColumns(10);
panelCentre.add(Leslabels.get(i), "cell 0 "+i+1);
panelCentre.add(Lesvaleurs.get(i), "cell 1 "+i+1 + ",grow");
panelCentre.add(Lesevaluer.get(i), "cell 2 "+i+1);
panelCentre.add(Lespoints.get(i), "cell 3 " + i+1 +",alignx left,growy");
panelCentre.add(LesBoutonsSuppr.get(i), "cell 0 "+i+1);
panelCentre.add(Leslabels.get(i), "cell 1 "+i+1);
panelCentre.add(Lesvaleurs.get(i), "cell 2 "+i+1 + ",grow");
panelCentre.add(Lesevaluer.get(i), "cell 3 "+i+1);
panelCentre.add(Lespoints.get(i), "cell 4 " + i+1 +",alignx left,growy");
}
//Enabled false les valeurs ne peuvent pas être modifiées.
@ -328,9 +392,8 @@ public class attributs extends JFrame {
}
}
System.out.println("code évaluateur = " + codeEvaluateur);
for(int i = 0 ; i<Leslabels.size();i++) {
for(int i = 0 ; i<KeysAttribut.size();i++) {
String value = Lesvaleurs.get(i).getText();
if(value.contains("")) value = value.substring(0,value.lastIndexOf(""));
@ -353,11 +416,17 @@ public class attributs extends JFrame {
nod.getAttributs().put(Leslabels.get(i).getText(), value);
J.refreshAffichage(nod);
dispose();
}
for(int j = 0 ; j < KeysRemove.size();j++) {
nod.supprimeAttribut(KeysRemove.get(j));
}
J.refreshAffichage(nod);
dispose();
}
});
@ -376,54 +445,37 @@ public class attributs extends JFrame {
private void refresh() {
Enumeration<String> 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(""));
}
}
JLabel lblNewLabel0 = new JLabel("Supprime");
lblNewLabel0.setFont(new Font("Tahoma", Font.BOLD, 11));
panelCentre.add(lblNewLabel0, "cell 0 0");
JTextField txtFielPoints = new JTextField(point);
JTextField txtFielValue = new JTextField(value);
txtFielValue.addMouseListener(new MyMouseListener());
txtFielPoints.setColumns(3);
checkEval.setSelected(evaluer);
JLabel lblNewLabel = new JLabel("Nom attribut");
lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 11));
panelCentre.add(lblNewLabel, "cell 1 0");
if(!KeysAttribut.contains(k)) {
Leslabels.add(new JLabel(k));
Lesvaleurs.add(txtFielValue);
Lespoints.add(txtFielPoints);
Lesevaluer.add(checkEval);
KeysAttribut.add(k);
}
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<Leslabels.size();i++) {
for(int i = 0 ; i<KeysAttribut.size();i++) {
Leslabels.get(i).setFont(new Font("Tahoma", Font.BOLD, 11));
Lesvaleurs.get(i).setColumns(10);
panelCentre.add(Leslabels.get(i), "cell 0 "+i+1);
panelCentre.add(Lesvaleurs.get(i), "cell 1 "+i+1 + ",grow");
panelCentre.add(Lesevaluer.get(i), "cell 2 "+i+1);
panelCentre.add(Lespoints.get(i), "cell 3 " + i+1 +",alignx left,growy");
panelCentre.add(LesBoutonsSuppr.get(i), "cell 0 "+i+1);
panelCentre.add(Leslabels.get(i), "cell 1 "+i+1+ ",grow");
panelCentre.add(Lesvaleurs.get(i), "cell 2 "+i+1 + ",grow");
panelCentre.add(Lesevaluer.get(i), "cell 3 "+i+1);
panelCentre.add(Lespoints.get(i), "cell 4 " + i+1 +",alignx left,growy");
}
//Enabled false les valeurs ne peuvent pas être modifiées.
@ -435,6 +487,11 @@ public class attributs extends JFrame {
//exception avec text:section et son attribut text:name qui doit être évaluable
if(nod.getNomElt().equals("text:section") && Leslabels.get(i).getText().equals("text:name")) {Lesvaleurs.get(i).setEnabled(true);Lesevaluer.get(i).setEnabled(true);Lespoints.get(i).setEnabled(true);}
}
panelCentre.repaint();
scrollPaneCentre.setViewportView(panelCentre);
scrollPaneCentre.revalidate();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B