Mise à jour de 'src/Test/ProfView.java'
This commit is contained in:
parent
73b9cb96d8
commit
cfc57bf2e4
@ -1,116 +1,116 @@
|
|||||||
package Test;
|
package Test;
|
||||||
|
|
||||||
import API.Etudiant;
|
import API.Etudiant;
|
||||||
import API.Groupe;
|
import API.Groupe;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ProfView extends JPanel {
|
public class ProfView extends JPanel {
|
||||||
private final ArrayList<Etudiant> e;
|
private final ArrayList<Etudiant> e;
|
||||||
private final ArrayList<Groupe> g;
|
private final ArrayList<Groupe> g;
|
||||||
private final Controller listener;
|
private final Controller listener;
|
||||||
private JComboBox<String> groupeOption;
|
private JComboBox<String> groupeOption;
|
||||||
private JTextField text;
|
private JTextField text;
|
||||||
|
|
||||||
public ProfView(ArrayList<Etudiant> e, ArrayList<Groupe> g, Controller listener) {
|
public ProfView(ArrayList<Etudiant> e, ArrayList<Groupe> g, Controller listener) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.setLayout(new GridBagLayout());
|
this.setLayout(new GridBagLayout());
|
||||||
|
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
this.e = e;
|
this.e = e;
|
||||||
this.g = g;
|
this.g = g;
|
||||||
|
|
||||||
this.Display();
|
this.Display();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getComboSelection() {
|
public String getComboSelection() {
|
||||||
return (String) this.groupeOption.getSelectedItem();
|
return (String) this.groupeOption.getSelectedItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSearchStud() {
|
public String getSearchStud() {
|
||||||
return this.text.getText();
|
return this.text.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getComboSelectionIndex() {
|
public int getComboSelectionIndex() {
|
||||||
return this.groupeOption.getSelectedIndex();
|
return this.groupeOption.getSelectedIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Display() {
|
public void Display() {
|
||||||
BLayout settings = new BLayout();
|
BLayout settings = new BLayout();
|
||||||
settings.setPositionX(0);
|
settings.setPositionX(0);
|
||||||
settings.setPositionY(6);
|
settings.setPositionY(6);
|
||||||
|
|
||||||
settings.setPositionY(0);
|
settings.setPositionY(0);
|
||||||
CustomJButton studList = new CustomJButton("Voir la liste des étudiants");
|
CustomJButton studList = new CustomJButton("Voir la liste des étudiants");
|
||||||
studList.setActionCommand("pv::GetStudList");
|
studList.setActionCommand("pv::GetStudList");
|
||||||
studList.addActionListener(this.listener);
|
studList.addActionListener(this.listener);
|
||||||
this.add(studList, settings);
|
this.add(studList, settings);
|
||||||
|
|
||||||
settings.setPositionY(1);
|
settings.setPositionY(1);
|
||||||
this.add(new JLabel(" "), settings);
|
this.add(new JLabel(" "), settings);
|
||||||
|
|
||||||
settings.setPositionY(2);
|
settings.setPositionY(2);
|
||||||
JLabel gs = new JLabel("Afficher les étudiants se trouvant dans le groupe :");
|
JLabel gs = new JLabel("Afficher les étudiants se trouvant dans le groupe :");
|
||||||
this.add(gs, settings);
|
this.add(gs, settings);
|
||||||
|
|
||||||
settings.setPositionY(3);
|
settings.setPositionY(3);
|
||||||
settings.setPadding(new Insets(0, 0, 0, 50));
|
settings.setPadding(new Insets(0, 0, 0, 50));
|
||||||
String[] groupeList = new String[this.g.size()];
|
String[] groupeList = new String[this.g.size()];
|
||||||
|
|
||||||
for(int i = 0; i <= this.g.size()-1; i++) {
|
for(int i = 0; i <= this.g.size()-1; i++) {
|
||||||
groupeList[i] = this.g.get(i).getName();
|
groupeList[i] = this.g.get(i).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.groupeOption = new JComboBox<>(groupeList);
|
this.groupeOption = new JComboBox<>(groupeList);
|
||||||
this.groupeOption.setPreferredSize(new Dimension(110, 30));
|
this.groupeOption.setPreferredSize(new Dimension(110, 30));
|
||||||
this.add(groupeOption, settings);
|
this.add(groupeOption, settings);
|
||||||
|
|
||||||
settings.setPositionY(3);
|
settings.setPositionY(3);
|
||||||
settings.setPadding(new Insets(0, 0, 0, 0));
|
settings.setPadding(new Insets(0, 0, 0, 0));
|
||||||
settings.setAnchor(GridBagConstraints.EAST);
|
settings.setAnchor(GridBagConstraints.EAST);
|
||||||
JButton confirm = new JButton("Rechercher");
|
CustomJButton confirm = new CustomJButton("Rechercher");
|
||||||
confirm.setActionCommand("pv::GetListFiltered");
|
confirm.setActionCommand("pv::GetListFiltered");
|
||||||
confirm.addActionListener(this.listener);
|
confirm.addActionListener(this.listener);
|
||||||
this.add(confirm, settings);
|
this.add(confirm, settings);
|
||||||
|
|
||||||
settings.setAnchor(GridBagConstraints.CENTER);
|
settings.setAnchor(GridBagConstraints.CENTER);
|
||||||
|
|
||||||
settings.setPositionY(4);
|
settings.setPositionY(4);
|
||||||
this.add(new JLabel(" "), settings);
|
this.add(new JLabel(" "), settings);
|
||||||
|
|
||||||
settings.setPositionY(5);
|
settings.setPositionY(5);
|
||||||
JLabel pf = new JLabel("Rechercher un étudiant : ");
|
JLabel pf = new JLabel("Rechercher un étudiant : ");
|
||||||
this.add(pf, settings);
|
this.add(pf, settings);
|
||||||
|
|
||||||
settings.setPositionY(6);
|
settings.setPositionY(6);
|
||||||
settings.setPadding(new Insets(0, 0, 0, 50));
|
settings.setPadding(new Insets(0, 0, 0, 50));
|
||||||
this.text = new JTextField();
|
this.text = new JTextField();
|
||||||
this.text.setPreferredSize(new Dimension(110, 30));
|
this.text.setPreferredSize(new Dimension(110, 30));
|
||||||
text.addKeyListener(new KeyAdapter() {
|
text.addKeyListener(new KeyAdapter() {
|
||||||
public void keyTyped(KeyEvent e) {
|
public void keyTyped(KeyEvent e) {
|
||||||
if (text.getText().length() >= 3 )
|
if (text.getText().length() >= 3 )
|
||||||
e.consume();
|
e.consume();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.add(this.text, settings);
|
this.add(this.text, settings);
|
||||||
|
|
||||||
settings.setPositionY(6);
|
settings.setPositionY(6);
|
||||||
settings.setPadding(new Insets(0, 0, 0, 0));
|
settings.setPadding(new Insets(0, 0, 0, 0));
|
||||||
settings.setAnchor(GridBagConstraints.EAST);
|
settings.setAnchor(GridBagConstraints.EAST);
|
||||||
JButton searchTLetters = new JButton("Rechercher");
|
CustomJButton searchTLetters = new CustomJButton("Rechercher");
|
||||||
searchTLetters.addActionListener(this.listener);
|
searchTLetters.addActionListener(this.listener);
|
||||||
searchTLetters.setActionCommand("pv::SearchStudentPer3Letters");
|
searchTLetters.setActionCommand("pv::SearchStudentPer3Letters");
|
||||||
this.add(searchTLetters, settings);
|
this.add(searchTLetters, settings);
|
||||||
|
|
||||||
this.repaint();
|
this.repaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user