From 71468f9fb8015f4b0d1f1460b71f0e2b9e940272 Mon Sep 17 00:00:00 2001 From: pablo rodriguez <58742538+1-pablo-rodriguez@users.noreply.github.com> Date: Fri, 19 Apr 2024 12:15:37 +0200 Subject: [PATCH] MAJ V4.5.0 --- src/fenetres/allContent.java | 61 +++++++++++++++++++++++++++-------- src/fenetres/create.java | 55 ++++++++++++++++--------------- src/list/descriptionNode.java | 3 +- 3 files changed, 78 insertions(+), 41 deletions(-) diff --git a/src/fenetres/allContent.java b/src/fenetres/allContent.java index c6dd7fe..e271fc4 100644 --- a/src/fenetres/allContent.java +++ b/src/fenetres/allContent.java @@ -5,6 +5,7 @@ import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.ArrayList; import javax.swing.DefaultComboBoxModel; import javax.swing.ImageIcon; @@ -37,7 +38,9 @@ public class allContent extends JFrame { private JLabel lblExplication; private JButton btnAdd = new JButton("Ajouter"); private JButton btnRemove = new JButton("Supprimer"); - private JCheckBox chckbxPlaceMethodeChildren = new JCheckBox("Place la méthode sur tous
les nodes enfants"); + private JCheckBox chckbxPlaceMethodeChildren = new JCheckBox("Place la méthode sur tous les nodes enfants"); + private JCheckBox chckbxplaceLaMthodeBrother = new JCheckBox("Place la méthode sur tous les nodes frères"); + private node nod; private afficheText J; @@ -69,7 +72,7 @@ public class allContent extends JFrame { setResizable(false); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - setBounds(100, 100, 700, 354); + setBounds(100, 100, 731, 354); ImageIcon img = new ImageIcon(getClass().getResource("/evalwriter.png") ); 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.setFont(new Font("Tahoma", Font.BOLD, 18)); - btnAdd.setBounds(458, 261, 216, 50); + btnAdd.setBounds(489, 261, 216, 50); contentPane.add(btnAdd); JLabel lblValeurDeLattribut = new JLabel("Algorithme d'évaluation"); @@ -98,14 +101,14 @@ public class allContent extends JFrame { JLabel lblDescription = new JLabel("Cet attribut permet d'évaluer le contenu du node et de celui des nodes enfants.
Par conséquent, tous les nodes enfants seront évalués."); lblDescription.setLabelFor(this); lblDescription.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblDescription.setBounds(10, 11, 633, 50); + lblDescription.setBounds(10, 11, 679, 50); contentPane.add(lblDescription); comboBoxValeur = new JComboBox(); comboBoxValeur.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 14)); comboBoxValeur.setModel(new DefaultComboBoxModel(new String[] {"strict", "strictSansEspace", "SansCasseEspaceChiffre", "environ"})); comboBoxValeur.setSelectedItem(valeur); - comboBoxValeur.setBounds(201, 119, 216, 30); + comboBoxValeur.setBounds(201, 119, 189, 30); contentPane.add(comboBoxValeur); JLabel lblPoint = new JLabel("Combien de point ?"); @@ -141,12 +144,12 @@ public class allContent extends JFrame { lblExplication.setText("Dans le fichier de l'étudiants.
Le contenu du node peut être plus ou moins proche (voir le paramètre similude), la CASSE est ignorée."); } - lblExplication.setBounds(26, 170, 633, 80); + lblExplication.setBounds(26, 170, 679, 80); contentPane.add(lblExplication); btnRemove.setIcon(new ImageIcon(allContent.class.getResource("/resources/false.png"))); btnRemove.setFont(new Font("Tahoma", Font.BOLD, 18)); - btnRemove.setBounds(232, 261, 216, 50); + btnRemove.setBounds(263, 261, 216, 50); contentPane.add(btnRemove); if(nod.isHasEnfant()) { @@ -161,8 +164,12 @@ public class allContent extends JFrame { chckbxPlaceMethodeChildren.setEnabled(false); } chckbxPlaceMethodeChildren.setFont(new Font("Tahoma", Font.PLAIN, 12)); - chckbxPlaceMethodeChildren.setBounds(458, 68, 216, 30); + chckbxPlaceMethodeChildren.setBounds(425, 68, 284, 30); contentPane.add(chckbxPlaceMethodeChildren); + + chckbxplaceLaMthodeBrother.setFont(new Font("Tahoma", Font.PLAIN, 12)); + chckbxplaceLaMthodeBrother.setBounds(425, 101, 284, 30); + contentPane.add(chckbxplaceLaMthodeBrother); Listener(); @@ -178,6 +185,15 @@ public class allContent extends JFrame { } } + private void placeAtrtibutAllContentDansLesNodesFreres(node nod,String methode, Integer point) { + ArrayList 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) { for(int i = 0 ; i < nod.getNodes().size(); i++) { if( listeDesNodesAllContent.isAllContent(nod.getNodes().get(i))){ @@ -185,6 +201,14 @@ public class allContent extends JFrame { } } + private void supprimeAttributAllConetnetDansLesNodesFreres(node nod) { + ArrayList 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() { @@ -194,12 +218,17 @@ public class allContent extends JFrame { int point = Integer.parseInt(textFieldPoint.getText()); if(point<0) point =0; - if(!chckbxPlaceMethodeChildren.isSelected()) { + if(!chckbxPlaceMethodeChildren.isSelected()&&!chckbxplaceLaMthodeBrother.isSelected()) { nod.getAttributs().put("allContent", comboBoxValeur.getSelectedItem().toString() + String.valueOf(point)); nod.evaluerAllChildTrue(); - }else { + } + if(chckbxPlaceMethodeChildren.isSelected()) { placeAtrtibutAllContentDansLesNodesChildren(nod,comboBoxValeur.getSelectedItem().toString(),point); - } + } + if(chckbxplaceLaMthodeBrother.isSelected()) { + placeAtrtibutAllContentDansLesNodesFreres(nod,comboBoxValeur.getSelectedItem().toString(),point); + } + J.refreshAffichage(nod); TreePath path = fenetres.create.getTree().getSelectionPath(); DefaultTreeModel model = (DefaultTreeModel) fenetres.create.getTree().getModel(); @@ -217,11 +246,15 @@ public class allContent extends JFrame { btnRemove.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - if(!chckbxPlaceMethodeChildren.isSelected()) { + if(!chckbxPlaceMethodeChildren.isSelected()&&!chckbxplaceLaMthodeBrother.isSelected()) { nod.supprimeAttribut("allContent"); - }else { + } + if(chckbxPlaceMethodeChildren.isSelected()) { supprimeAttributAllConetnetDansLesNodesChildren(nod); - } + } + if(chckbxplaceLaMthodeBrother.isSelected()) { + supprimeAttributAllConetnetDansLesNodesFreres(nod); + } J.refreshAffichage(nod); TreePath path = fenetres.create.getTree().getSelectionPath(); DefaultTreeModel model = (DefaultTreeModel) fenetres.create.getTree().getModel(); diff --git a/src/fenetres/create.java b/src/fenetres/create.java index baf50d9..54ea849 100644 --- a/src/fenetres/create.java +++ b/src/fenetres/create.java @@ -3,10 +3,9 @@ package fenetres; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; @@ -31,6 +30,8 @@ import javax.swing.SwingConstants; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.event.TreeSelectionEvent; 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.TreeModel; import javax.swing.tree.TreeNode; @@ -125,7 +126,6 @@ public final class create extends JFrame { private JToolBar toolBarPrincipal; private JMenuBar menuBar = new JMenuBar(); private static JButton buttonEvaluate; - private JPanel panelPrincipal; private JPanel panelDroiteBoutons= new JPanel(); private static create instance; public static boolean isDispose = true; @@ -277,10 +277,12 @@ public final class create extends JFrame { tree.setComponentPopupMenu(null); this.createToolBar(); - - panelPrincipal = new JPanel(); - getContentPane().add(panelPrincipal, BorderLayout.NORTH); - + // Utiliser un BoxLayout pour la barre d'outils (pour plusieurs lignes et redimensionnement) + +// 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 if(commandes.fichierAnalyseValide) tree = commandes.tree; @@ -311,20 +313,21 @@ public final class create extends JFrame { textNodeSelect.setFont(new Font("Monospaced", Font.PLAIN, 15)); JScrollPane ScrollPaneTableBouton = new JScrollPane( ); + panelDroiteBoutons.setBackground(Color.LIGHT_GRAY); 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]")); rightScrollPane.setViewportView(panelDroiteBoutons); - ScrollPaneTableBouton = new JScrollPane(textNodeSelect); + ScrollPaneTableBouton.setViewportView(textNodeSelect); + lblNewLabel_1.setIcon(new ImageIcon(create.class.getResource("/resources/evaluermini.png"))); lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 14)); panelDroiteBoutons.add(lblNewLabel_1, "cell 0 0 6 1,aligny center,grow"); btnAttribut.setText(""); + - - // Ligne 2 btnAttribut.setHorizontalAlignment(SwingConstants.LEFT); btnAttribut.setForeground(new Color(0, 128, 192)); 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 ); splitPane2.setBounds(10, 10, 1364, 783); - splitPane2.setBounds(10, 10, 1364, 783); 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 ); 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)); getContentPane().add(splitPane1, BorderLayout.CENTER); - panelPrincipal.setLayout(new GridLayout(1, 1, 0, 0)); - panelPrincipal.add(toolBarPrincipal); - - if(commandes.fichierAnalyseValide) { tree.setVisible(true); @@ -710,7 +723,7 @@ public final class create extends JFrame { */ private void createToolBar() { toolBarPrincipal = new JToolBar(); - toolBarPrincipal.setFloatable(false); + toolBarPrincipal.setFloatable(true); toolBarPrincipal.setRollover(true); toolBarPrincipal.setName("outils principaux"); @@ -723,20 +736,11 @@ public final class create extends JFrame { toolBarPrincipal.addSeparator(); 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.setHideActionText(true); toolBarPrincipal.add(btnSaveEvaluation); 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.setHideActionText(true); @@ -947,7 +951,6 @@ public final class create extends JFrame { commandes.tree = new JTree(root); tree.setCellRenderer(new MyTreeCellRenderer()); -// tree.setCellRenderer(new MyCellRenderer()); tree.setModel(commandes.tree.getModel()) ; diff --git a/src/list/descriptionNode.java b/src/list/descriptionNode.java index c27764d..3c643ea 100644 --- a/src/list/descriptionNode.java +++ b/src/list/descriptionNode.java @@ -190,7 +190,8 @@ public class descriptionNode { return descriptionNode; } case "text:soft-page-break": { - descriptionNode = descriptionNode + "

Saut de page généré par writer lorsqu'une page ne peut pas contenir le texte.
" + descriptionNode = descriptionNode + "

Saut de page généré automatiquement par writer lorsqu'une page ne peut pas contenir plus de texte.
" + + "Les paragraphes sont alors être scindés par un saut de page automatique (sauf spécification dans le format du paragraphe).
" + "documentation OASIS

"; return descriptionNode; }