MAJ V4.5.0

This commit is contained in:
pablo rodriguez 2024-04-19 12:15:37 +02:00
parent 63e3b5857c
commit 71468f9fb8
3 changed files with 78 additions and 41 deletions

View File

@ -5,6 +5,7 @@ import java.awt.Color;
import java.awt.Font; import java.awt.Font;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
@ -37,7 +38,9 @@ public class allContent extends JFrame {
private JLabel lblExplication; private JLabel lblExplication;
private JButton btnAdd = new JButton("Ajouter"); private JButton btnAdd = new JButton("Ajouter");
private JButton btnRemove = new JButton("Supprimer"); private JButton btnRemove = new JButton("Supprimer");
private JCheckBox chckbxPlaceMethodeChildren = new JCheckBox("<html>Place la méthode sur tous<br>les nodes enfants</html>"); private JCheckBox chckbxPlaceMethodeChildren = new JCheckBox("<html>Place la méthode sur tous les nodes enfants</html>");
private JCheckBox chckbxplaceLaMthodeBrother = new JCheckBox("<html>Place la méthode sur tous les nodes frères</html>");
private node nod; private node nod;
private afficheText J; private afficheText J;
@ -69,7 +72,7 @@ public class allContent extends JFrame {
setResizable(false); setResizable(false);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 700, 354); setBounds(100, 100, 731, 354);
ImageIcon img = new ImageIcon(getClass().getResource("/evalwriter.png") ); ImageIcon img = new ImageIcon(getClass().getResource("/evalwriter.png") );
int screenWidth = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth(); int screenWidth = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth();
@ -87,7 +90,7 @@ public class allContent extends JFrame {
btnAdd.setIcon(new ImageIcon(allContent.class.getResource("/resources/true.png"))); btnAdd.setIcon(new ImageIcon(allContent.class.getResource("/resources/true.png")));
btnAdd.setFont(new Font("Tahoma", Font.BOLD, 18)); btnAdd.setFont(new Font("Tahoma", Font.BOLD, 18));
btnAdd.setBounds(458, 261, 216, 50); btnAdd.setBounds(489, 261, 216, 50);
contentPane.add(btnAdd); contentPane.add(btnAdd);
JLabel lblValeurDeLattribut = new JLabel("Algorithme d'évaluation"); JLabel lblValeurDeLattribut = new JLabel("Algorithme d'évaluation");
@ -98,14 +101,14 @@ public class allContent extends JFrame {
JLabel lblDescription = new JLabel("<html>Cet attribut permet d'évaluer le contenu du node et de celui des nodes enfants.<br>Par conséquent, tous les nodes enfants seront évalués.</html>"); JLabel lblDescription = new JLabel("<html>Cet attribut permet d'évaluer le contenu du node et de celui des nodes enfants.<br>Par conséquent, tous les nodes enfants seront évalués.</html>");
lblDescription.setLabelFor(this); lblDescription.setLabelFor(this);
lblDescription.setFont(new Font("Tahoma", Font.BOLD, 13)); lblDescription.setFont(new Font("Tahoma", Font.BOLD, 13));
lblDescription.setBounds(10, 11, 633, 50); lblDescription.setBounds(10, 11, 679, 50);
contentPane.add(lblDescription); contentPane.add(lblDescription);
comboBoxValeur = new JComboBox<String>(); comboBoxValeur = new JComboBox<String>();
comboBoxValeur.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 14)); comboBoxValeur.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 14));
comboBoxValeur.setModel(new DefaultComboBoxModel<String>(new String[] {"strict", "strictSansEspace", "SansCasseEspaceChiffre", "environ"})); comboBoxValeur.setModel(new DefaultComboBoxModel<String>(new String[] {"strict", "strictSansEspace", "SansCasseEspaceChiffre", "environ"}));
comboBoxValeur.setSelectedItem(valeur); comboBoxValeur.setSelectedItem(valeur);
comboBoxValeur.setBounds(201, 119, 216, 30); comboBoxValeur.setBounds(201, 119, 189, 30);
contentPane.add(comboBoxValeur); contentPane.add(comboBoxValeur);
JLabel lblPoint = new JLabel("Combien de point ?"); JLabel lblPoint = new JLabel("Combien de point ?");
@ -141,12 +144,12 @@ public class allContent extends JFrame {
lblExplication.setText("<html>Dans le fichier de l'étudiants.<br>Le contenu du node peut être plus ou moins proche (voir le paramètre similude), la CASSE est ignorée.</html>"); lblExplication.setText("<html>Dans le fichier de l'étudiants.<br>Le contenu du node peut être plus ou moins proche (voir le paramètre similude), la CASSE est ignorée.</html>");
} }
lblExplication.setBounds(26, 170, 633, 80); lblExplication.setBounds(26, 170, 679, 80);
contentPane.add(lblExplication); contentPane.add(lblExplication);
btnRemove.setIcon(new ImageIcon(allContent.class.getResource("/resources/false.png"))); btnRemove.setIcon(new ImageIcon(allContent.class.getResource("/resources/false.png")));
btnRemove.setFont(new Font("Tahoma", Font.BOLD, 18)); btnRemove.setFont(new Font("Tahoma", Font.BOLD, 18));
btnRemove.setBounds(232, 261, 216, 50); btnRemove.setBounds(263, 261, 216, 50);
contentPane.add(btnRemove); contentPane.add(btnRemove);
if(nod.isHasEnfant()) { if(nod.isHasEnfant()) {
@ -161,8 +164,12 @@ public class allContent extends JFrame {
chckbxPlaceMethodeChildren.setEnabled(false); chckbxPlaceMethodeChildren.setEnabled(false);
} }
chckbxPlaceMethodeChildren.setFont(new Font("Tahoma", Font.PLAIN, 12)); chckbxPlaceMethodeChildren.setFont(new Font("Tahoma", Font.PLAIN, 12));
chckbxPlaceMethodeChildren.setBounds(458, 68, 216, 30); chckbxPlaceMethodeChildren.setBounds(425, 68, 284, 30);
contentPane.add(chckbxPlaceMethodeChildren); contentPane.add(chckbxPlaceMethodeChildren);
chckbxplaceLaMthodeBrother.setFont(new Font("Tahoma", Font.PLAIN, 12));
chckbxplaceLaMthodeBrother.setBounds(425, 101, 284, 30);
contentPane.add(chckbxplaceLaMthodeBrother);
Listener(); Listener();
@ -178,6 +185,15 @@ public class allContent extends JFrame {
} }
} }
private void placeAtrtibutAllContentDansLesNodesFreres(node nod,String methode, Integer point) {
ArrayList<node> nodFreres = nod.retourneTousLesFreres();
for(int i = 0 ; i < nodFreres.size(); i++) {
if( listeDesNodesAllContent.isAllContent(nodFreres.get(i))){
nodFreres.get(i).getAttributs().put("allContent", methode+String.valueOf(point));
nodFreres.get(i).evaluerAllChildTrue(); }
}
}
private void supprimeAttributAllConetnetDansLesNodesChildren(node nod) { private void supprimeAttributAllConetnetDansLesNodesChildren(node nod) {
for(int i = 0 ; i < nod.getNodes().size(); i++) { for(int i = 0 ; i < nod.getNodes().size(); i++) {
if( listeDesNodesAllContent.isAllContent(nod.getNodes().get(i))){ if( listeDesNodesAllContent.isAllContent(nod.getNodes().get(i))){
@ -185,6 +201,14 @@ public class allContent extends JFrame {
} }
} }
private void supprimeAttributAllConetnetDansLesNodesFreres(node nod) {
ArrayList<node> nodFreres = nod.retourneTousLesFreres();
for(int i = 0 ; i < nodFreres.size(); i++) {
if( listeDesNodesAllContent.isAllContent(nodFreres.get(i))){
nodFreres.get(i).supprimeAttribut("allContent"); }
}
}
private void Listener() { private void Listener() {
@ -194,12 +218,17 @@ public class allContent extends JFrame {
int point = Integer.parseInt(textFieldPoint.getText()); int point = Integer.parseInt(textFieldPoint.getText());
if(point<0) point =0; if(point<0) point =0;
if(!chckbxPlaceMethodeChildren.isSelected()) { if(!chckbxPlaceMethodeChildren.isSelected()&&!chckbxplaceLaMthodeBrother.isSelected()) {
nod.getAttributs().put("allContent", comboBoxValeur.getSelectedItem().toString() + String.valueOf(point)); nod.getAttributs().put("allContent", comboBoxValeur.getSelectedItem().toString() + String.valueOf(point));
nod.evaluerAllChildTrue(); nod.evaluerAllChildTrue();
}else { }
if(chckbxPlaceMethodeChildren.isSelected()) {
placeAtrtibutAllContentDansLesNodesChildren(nod,comboBoxValeur.getSelectedItem().toString(),point); placeAtrtibutAllContentDansLesNodesChildren(nod,comboBoxValeur.getSelectedItem().toString(),point);
} }
if(chckbxplaceLaMthodeBrother.isSelected()) {
placeAtrtibutAllContentDansLesNodesFreres(nod,comboBoxValeur.getSelectedItem().toString(),point);
}
J.refreshAffichage(nod); J.refreshAffichage(nod);
TreePath path = fenetres.create.getTree().getSelectionPath(); TreePath path = fenetres.create.getTree().getSelectionPath();
DefaultTreeModel model = (DefaultTreeModel) fenetres.create.getTree().getModel(); DefaultTreeModel model = (DefaultTreeModel) fenetres.create.getTree().getModel();
@ -217,11 +246,15 @@ public class allContent extends JFrame {
btnRemove.addActionListener(new ActionListener() { btnRemove.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if(!chckbxPlaceMethodeChildren.isSelected()) { if(!chckbxPlaceMethodeChildren.isSelected()&&!chckbxplaceLaMthodeBrother.isSelected()) {
nod.supprimeAttribut("allContent"); nod.supprimeAttribut("allContent");
}else { }
if(chckbxPlaceMethodeChildren.isSelected()) {
supprimeAttributAllConetnetDansLesNodesChildren(nod); supprimeAttributAllConetnetDansLesNodesChildren(nod);
} }
if(chckbxplaceLaMthodeBrother.isSelected()) {
supprimeAttributAllConetnetDansLesNodesFreres(nod);
}
J.refreshAffichage(nod); J.refreshAffichage(nod);
TreePath path = fenetres.create.getTree().getSelectionPath(); TreePath path = fenetres.create.getTree().getSelectionPath();
DefaultTreeModel model = (DefaultTreeModel) fenetres.create.getTree().getModel(); DefaultTreeModel model = (DefaultTreeModel) fenetres.create.getTree().getModel();

View File

@ -3,10 +3,9 @@ package fenetres;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font; import java.awt.Font;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent; import java.awt.event.InputEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
@ -31,6 +30,8 @@ import javax.swing.SwingConstants;
import javax.swing.UnsupportedLookAndFeelException; import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener; import javax.swing.event.TreeSelectionListener;
import javax.swing.plaf.SplitPaneUI;
import javax.swing.plaf.basic.BasicSplitPaneUI;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeModel; import javax.swing.tree.TreeModel;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
@ -125,7 +126,6 @@ public final class create extends JFrame {
private JToolBar toolBarPrincipal; private JToolBar toolBarPrincipal;
private JMenuBar menuBar = new JMenuBar(); private JMenuBar menuBar = new JMenuBar();
private static JButton buttonEvaluate; private static JButton buttonEvaluate;
private JPanel panelPrincipal;
private JPanel panelDroiteBoutons= new JPanel(); private JPanel panelDroiteBoutons= new JPanel();
private static create instance; private static create instance;
public static boolean isDispose = true; public static boolean isDispose = true;
@ -277,10 +277,12 @@ public final class create extends JFrame {
tree.setComponentPopupMenu(null); tree.setComponentPopupMenu(null);
this.createToolBar(); this.createToolBar();
// Utiliser un BoxLayout pour la barre d'outils (pour plusieurs lignes et redimensionnement)
panelPrincipal = new JPanel();
getContentPane().add(panelPrincipal, BorderLayout.NORTH); // BoxLayout layout = new BoxLayout(toolBarPrincipal, BoxLayout.X_AXIS);
FlowLayout layout = new FlowLayout(FlowLayout.LEFT);
toolBarPrincipal.setLayout(layout);
getContentPane().add(toolBarPrincipal,BorderLayout.NORTH);
// The content of the window // The content of the window
if(commandes.fichierAnalyseValide) tree = commandes.tree; if(commandes.fichierAnalyseValide) tree = commandes.tree;
@ -311,20 +313,21 @@ public final class create extends JFrame {
textNodeSelect.setFont(new Font("Monospaced", Font.PLAIN, 15)); textNodeSelect.setFont(new Font("Monospaced", Font.PLAIN, 15));
JScrollPane ScrollPaneTableBouton = new JScrollPane( ); JScrollPane ScrollPaneTableBouton = new JScrollPane( );
panelDroiteBoutons.setBackground(Color.LIGHT_GRAY);
panelDroiteBoutons.setBorder(null); panelDroiteBoutons.setBorder(null);
panelDroiteBoutons.setLayout(new MigLayout("", "[40px:n,fill][40px:n,fill][40px:n,fill][40px:n,fill][40px:n,fill][40px:n,fill]", "[20px][40px][40px][60px][60px][60px][60px][60px][60px][60px][60px][60px][60px]")); panelDroiteBoutons.setLayout(new MigLayout("", "[40px:n,fill][40px:n,fill][40px:n,fill][40px:n,fill][40px:n,fill][40px:n,fill]", "[20px][40px][40px][60px][60px][60px][60px][60px][60px][60px][60px][60px][60px]"));
rightScrollPane.setViewportView(panelDroiteBoutons); rightScrollPane.setViewportView(panelDroiteBoutons);
ScrollPaneTableBouton = new JScrollPane(textNodeSelect); ScrollPaneTableBouton.setViewportView(textNodeSelect);
lblNewLabel_1.setIcon(new ImageIcon(create.class.getResource("/resources/evaluermini.png"))); lblNewLabel_1.setIcon(new ImageIcon(create.class.getResource("/resources/evaluermini.png")));
lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 14)); lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 14));
panelDroiteBoutons.add(lblNewLabel_1, "cell 0 0 6 1,aligny center,grow"); panelDroiteBoutons.add(lblNewLabel_1, "cell 0 0 6 1,aligny center,grow");
btnAttribut.setText(""); btnAttribut.setText("");
// Ligne 2
btnAttribut.setHorizontalAlignment(SwingConstants.LEFT); btnAttribut.setHorizontalAlignment(SwingConstants.LEFT);
btnAttribut.setForeground(new Color(0, 128, 192)); btnAttribut.setForeground(new Color(0, 128, 192));
panelDroiteBoutons.add(btnAttribut, "cell 0 1,grow"); panelDroiteBoutons.add(btnAttribut, "cell 0 1,grow");
@ -412,8 +415,22 @@ public final class create extends JFrame {
JSplitPane splitPane2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, rightScrollPane, ScrollPaneTableBouton ); JSplitPane splitPane2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, rightScrollPane, ScrollPaneTableBouton );
splitPane2.setBounds(10, 10, 1364, 783); splitPane2.setBounds(10, 10, 1364, 783);
splitPane2.setBounds(10, 10, 1364, 783);
splitPane2.setDividerLocation(0.4); splitPane2.setDividerLocation(0.4);
splitPane2.setOneTouchExpandable(true);
SplitPaneUI spui = splitPane2.getUI();
if (spui instanceof BasicSplitPaneUI) {
((BasicSplitPaneUI) spui).getDivider().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
if (arg0.getClickCount() == 2) {
Dimension size1 = rightScrollPane.getPreferredSize();
int dividerLocation = splitPane2.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ?
size1.width : size1.height;
splitPane2.setDividerLocation(dividerLocation);
}
}
});
}
JSplitPane splitPane1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panelLeft, splitPane2 ); JSplitPane splitPane1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panelLeft, splitPane2 );
splitPane1.setBounds(10, 10, 1364, 783); //10, 10, 1364, 783 splitPane1.setBounds(10, 10, 1364, 783); //10, 10, 1364, 783
@ -424,10 +441,6 @@ public final class create extends JFrame {
tree.setFont(new Font("Tahoma", Font.PLAIN, 16)); tree.setFont(new Font("Tahoma", Font.PLAIN, 16));
getContentPane().add(splitPane1, BorderLayout.CENTER); getContentPane().add(splitPane1, BorderLayout.CENTER);
panelPrincipal.setLayout(new GridLayout(1, 1, 0, 0));
panelPrincipal.add(toolBarPrincipal);
if(commandes.fichierAnalyseValide) { if(commandes.fichierAnalyseValide) {
tree.setVisible(true); tree.setVisible(true);
@ -710,7 +723,7 @@ public final class create extends JFrame {
*/ */
private void createToolBar() { private void createToolBar() {
toolBarPrincipal = new JToolBar(); toolBarPrincipal = new JToolBar();
toolBarPrincipal.setFloatable(false); toolBarPrincipal.setFloatable(true);
toolBarPrincipal.setRollover(true); toolBarPrincipal.setRollover(true);
toolBarPrincipal.setName("outils principaux"); toolBarPrincipal.setName("outils principaux");
@ -723,20 +736,11 @@ public final class create extends JFrame {
toolBarPrincipal.addSeparator(); toolBarPrincipal.addSeparator();
JButton btnSaveEvaluation = toolBarPrincipal.add( new actSaveEvaluation() ); JButton btnSaveEvaluation = toolBarPrincipal.add( new actSaveEvaluation() );
btnSaveEvaluation.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
btnSaveEvaluation.setIcon(new ImageIcon(create.class.getResource("/resources/saveEvaluation.png"))); btnSaveEvaluation.setIcon(new ImageIcon(create.class.getResource("/resources/saveEvaluation.png")));
btnSaveEvaluation.setHideActionText(true); btnSaveEvaluation.setHideActionText(true);
toolBarPrincipal.add(btnSaveEvaluation); toolBarPrincipal.add(btnSaveEvaluation);
JButton btnNewFichierAnalyse = toolBarPrincipal.add( new actNewFichierAnalyse() ); JButton btnNewFichierAnalyse = toolBarPrincipal.add( new actNewFichierAnalyse() );
btnNewFichierAnalyse.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
btnNewFichierAnalyse.setIcon(new ImageIcon(create.class.getResource("/resources/fichierODF.png"))); btnNewFichierAnalyse.setIcon(new ImageIcon(create.class.getResource("/resources/fichierODF.png")));
btnNewFichierAnalyse.setHideActionText(true); btnNewFichierAnalyse.setHideActionText(true);
@ -947,7 +951,6 @@ public final class create extends JFrame {
commandes.tree = new JTree(root); commandes.tree = new JTree(root);
tree.setCellRenderer(new MyTreeCellRenderer()); tree.setCellRenderer(new MyTreeCellRenderer());
// tree.setCellRenderer(new MyCellRenderer());
tree.setModel(commandes.tree.getModel()) ; tree.setModel(commandes.tree.getModel()) ;

View File

@ -190,7 +190,8 @@ public class descriptionNode {
return descriptionNode; return descriptionNode;
} }
case "text:soft-page-break": { case "text:soft-page-break": {
descriptionNode = descriptionNode + "<p>Saut de page généré par writer lorsqu'une page ne peut pas contenir le texte.<br>" descriptionNode = descriptionNode + "<p>Saut de page généré automatiquement par writer lorsqu'une page ne peut pas contenir plus de texte.<br>"
+ "Les paragraphes sont alors être scindés par un saut de page automatique (sauf spécification dans le format du paragraphe).<br>"
+ "<a href=\"http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1415190_253892949\">documentation OASIS</a></p>"; + "<a href=\"http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1415190_253892949\">documentation OASIS</a></p>";
return descriptionNode; return descriptionNode;
} }