debut affichage arborescence
This commit is contained in:
@@ -1,19 +1,20 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.Graphic.Model;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Set;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
import javax.swing.tree.*;
|
||||
import javax.swing.event.*;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.AbstractGroupeFactory;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.TypeGroupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Graphic.Controller.ObservateurFenetre;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Graphic.Controller.TreeSelectionListenerGroupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Graphic.Util.BD;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Graphic.View.Chargement;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Graphic.View.FenetreEtudiant;
|
||||
@@ -35,6 +36,7 @@ public class Model{
|
||||
Chargement ch=new Chargement();
|
||||
this.promo=this.getPromo(ch);
|
||||
ch.dispose();
|
||||
JTree tree=new JTree();
|
||||
if(this.promo==null){
|
||||
this.fenGr=new FenetreGroupe(null, this);
|
||||
this.fenEtu=new FenetreEtudiant(null);
|
||||
@@ -51,7 +53,7 @@ public class Model{
|
||||
this.fenetre.setLayout(new GridLayout(1,2));
|
||||
this.fenetre.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
this.fenetre.setMinimumSize(this.fenetre.getSize());
|
||||
this.fenetre.add(this.fenGr);
|
||||
this.fenetre.add(tree.add(this.fenGr));
|
||||
JScrollPane scroll=new JScrollPane(this.fenEtu);
|
||||
scroll.getVerticalScrollBar().setUnitIncrement(15);
|
||||
this.fenetre.add(scroll);
|
||||
@@ -60,7 +62,9 @@ public class Model{
|
||||
this.showGroupe(this.promo.getPromotion());
|
||||
}
|
||||
|
||||
|
||||
private void nouvelleCible(TreePath e){
|
||||
System.out.println(e.getLastPathComponent().toString());
|
||||
}
|
||||
/**
|
||||
* Fonction pour refresh/changer de groupe d'affichage
|
||||
* @param g le groupe a afficher
|
||||
@@ -68,10 +72,19 @@ public class Model{
|
||||
public void showGroupe(Groupe g){
|
||||
if(g!=null)
|
||||
g=this.bd.refreshALL(g);
|
||||
DefaultMutableTreeNode mut=new DefaultMutableTreeNode(g);
|
||||
JTree arbre = new JTree(mut);
|
||||
arbre.setEditable(true);
|
||||
arbre.setShowsRootHandles(true);
|
||||
arbre.getSelectionModel().setSelectionMode(
|
||||
TreeSelectionModel.SINGLE_TREE_SELECTION);
|
||||
|
||||
arbre.addTreeSelectionListener(new TreeSelectionListenerGroupe(this));
|
||||
|
||||
this.fenGr=new FenetreGroupe(g, this);
|
||||
this.fenEtu=new FenetreEtudiant(g);
|
||||
this.fenetre.getContentPane().removeAll();
|
||||
this.fenetre.add(this.fenGr);
|
||||
this.fenetre.add(arbre);
|
||||
JScrollPane scroll=new JScrollPane(this.fenEtu);
|
||||
scroll.getVerticalScrollBar().setUnitIncrement(15);
|
||||
this.fenetre.add(scroll);
|
||||
|
Reference in New Issue
Block a user