$
This commit is contained in:
parent
5e727b4745
commit
e4ac30b549
BIN
build/Test/libs/mariadb-connector.jar
Normal file
BIN
build/Test/libs/mariadb-connector.jar
Normal file
Binary file not shown.
@ -54,6 +54,18 @@ public class AdminView extends JPanel {
|
||||
addStudGrup.setActionCommand("av::AddStudGrup");
|
||||
this.add(addStudGrup, settings);
|
||||
|
||||
settings.setPositionY(5);
|
||||
this.add(new JLabel(" "), settings);
|
||||
|
||||
settings.setPositionY(6);
|
||||
this.add(new JLabel(" "), settings);
|
||||
|
||||
settings.setPositionY(7);
|
||||
CustomJButton createGrup = new CustomJButton("Créer un groupe");
|
||||
createGrup.addActionListener(this.listener);
|
||||
createGrup.setActionCommand("av::CreateGrup");
|
||||
this.add(createGrup, settings);
|
||||
|
||||
this.repaint();
|
||||
}
|
||||
}
|
||||
|
@ -38,10 +38,11 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
private JComboBox<String> requestTypeSelector;
|
||||
|
||||
private JTextArea content;
|
||||
|
||||
private ArrayList<String> tmpStud;
|
||||
|
||||
private int x;
|
||||
private JTextField l1;
|
||||
private JTextField l2;
|
||||
private JTextField l3;
|
||||
|
||||
public Controller(BDatabase db) {
|
||||
this.db = db;
|
||||
@ -156,7 +157,7 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
String[] info = {
|
||||
this.e.get(i).getNom(),
|
||||
this.e.get(i).getPrenom(),
|
||||
String.valueOf(this.e.get(i).getGroupe())
|
||||
this.getGroupeById(this.e.get(i).getGroupe())
|
||||
};
|
||||
|
||||
data[i] = info;
|
||||
@ -470,6 +471,87 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
|
||||
Display(this.createJTable(data, title));
|
||||
}
|
||||
|
||||
else if(Objects.equals(command, "av::CreateGrup")) {
|
||||
JPanel forModal = new JPanel(new GridBagLayout());
|
||||
BLayout settings = new BLayout();
|
||||
settings.setPositionX(0);
|
||||
|
||||
settings.setPositionY(1);
|
||||
forModal.add(new JLabel("Nom du groupe (EXEMPLE: Groupe du soleil)"), settings);
|
||||
|
||||
settings.setPositionY(2);
|
||||
this.l1 = new JTextField();
|
||||
this.l1.setPreferredSize(new Dimension(130, 30));
|
||||
forModal.add(this.l1, settings);
|
||||
|
||||
settings.setPositionY(3);
|
||||
forModal.add(new JLabel(" "), settings);
|
||||
|
||||
settings.setPositionY(4);
|
||||
forModal.add(new JLabel("Taille maximum (uniquement des chiffres)"), settings);
|
||||
|
||||
settings.setPositionY(5);
|
||||
this.l2 = new JTextField();
|
||||
this.l2.setPreferredSize(new Dimension(30, 30));
|
||||
forModal.add(this.l2, settings);
|
||||
|
||||
settings.setPositionY(6);
|
||||
forModal.add(new JLabel(" "), settings);
|
||||
|
||||
settings.setPositionY(7);
|
||||
forModal.add(new JLabel("Taille minimum (uniquement des chiffres)"), settings);
|
||||
|
||||
settings.setPositionY(8);
|
||||
this.l3 = new JTextField();
|
||||
this.l3.setPreferredSize(new Dimension(30, 30));
|
||||
forModal.add(this.l3, settings);
|
||||
|
||||
settings.setPositionY(9);
|
||||
forModal.add(new JLabel(" "), settings);
|
||||
|
||||
settings.setPositionY(10);
|
||||
forModal.add(new JLabel(" "), settings);
|
||||
|
||||
settings.setPositionY(11);
|
||||
CustomJButton create = new CustomJButton("Créer");
|
||||
create.addActionListener(this);
|
||||
create.setActionCommand("av::CreateGrupOnDatabase");
|
||||
forModal.add(create, settings);
|
||||
|
||||
DisplayModal(
|
||||
"Creation de groupe",
|
||||
750,
|
||||
500,
|
||||
this.parent.getLocation().x + (this.parent.getSize().width - 750) / 2,
|
||||
this.parent.getLocation().y + (this.parent.getSize().height - 500) / 2,
|
||||
forModal
|
||||
);
|
||||
}
|
||||
|
||||
else if(Objects.equals(command, "av::CreateGrupOnDatabase")) {
|
||||
String nom = this.l1.getText();
|
||||
String max = this.l2.getText();
|
||||
String min = this.l3.getText();
|
||||
|
||||
if(this.db.insertRow("fi_groupes", new String[]{"nom", "min", "max"}, new String[]{nom, min, max})) {
|
||||
JOptionPane.showMessageDialog(
|
||||
this.parent,
|
||||
"Groupe" + nom + "creer !",
|
||||
"Succes",
|
||||
JOptionPane.INFORMATION_MESSAGE
|
||||
);
|
||||
|
||||
this.g = this.db.getGroupeList();
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(
|
||||
this.parent,
|
||||
"La creation du groupe : " + nom + " à échoué.",
|
||||
"Erreur",
|
||||
JOptionPane.ERROR_MESSAGE
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -589,13 +671,17 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
Object[] info = {
|
||||
this.e.get(i).getNom(),
|
||||
this.e.get(i).getPrenom(),
|
||||
String.valueOf(this.e.get(i).getGroupe())
|
||||
this.getGroupeById(this.e.get(i).getGroupe())
|
||||
};
|
||||
data[i] = info;
|
||||
}
|
||||
return createJTable(data, title);
|
||||
}
|
||||
|
||||
public String getGroupeById(int id) {
|
||||
return this.db.fetchAll("SELECT nom FROM fi_groupe WHERE id = " + id).get(0);
|
||||
}
|
||||
|
||||
public ProfView getProfView() {
|
||||
return this.pv;
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ import java.awt.Font;
|
||||
* Bouton personnalisé avec des bords arrondis et un fond transparent
|
||||
*/
|
||||
public class CustomJButton extends JButton {
|
||||
private Font font = new Font("Arial", Font.PLAIN, 12);
|
||||
private Color color = Color.BLACK;
|
||||
private Font font;
|
||||
private Color color;
|
||||
//private final int radius = 20;
|
||||
|
||||
/**
|
||||
@ -19,8 +19,9 @@ public class CustomJButton extends JButton {
|
||||
*/
|
||||
public CustomJButton(String text, Color c) {
|
||||
super(text);
|
||||
this.font = new Font("Arial", Font.PLAIN, 12);
|
||||
this.color = c;
|
||||
init();
|
||||
this.init();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -31,7 +32,7 @@ public class CustomJButton extends JButton {
|
||||
super(text);
|
||||
this.color = c;
|
||||
this.font = font;
|
||||
init();
|
||||
this.init();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -40,8 +41,9 @@ public class CustomJButton extends JButton {
|
||||
*/
|
||||
public CustomJButton(String text, Font font) {
|
||||
super(text);
|
||||
this.color = Color.BLACK;
|
||||
this.font = font;
|
||||
init();
|
||||
this.init();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -49,14 +51,16 @@ public class CustomJButton extends JButton {
|
||||
*/
|
||||
public CustomJButton(String text) {
|
||||
super(text);
|
||||
init();
|
||||
this.font = new Font("Arial", Font.PLAIN, 12);
|
||||
this.color = Color.BLACK;
|
||||
this.init();
|
||||
}
|
||||
|
||||
|
||||
private void init() {
|
||||
this.setForeground(Color.WHITE);
|
||||
this.setBackground(color);
|
||||
this.setFont(font);
|
||||
this.setBackground(this.color);
|
||||
this.setFont(this.font);
|
||||
this.setFocusPainted(false);
|
||||
this.setContentAreaFilled(true);
|
||||
//this.setBorderPainted(false);
|
||||
|
Loading…
Reference in New Issue
Block a user