This commit is contained in:
pro.boooooo
2022-11-15 20:03:04 +01:00
parent dd958e5067
commit f236e39d7c
102 changed files with 29019 additions and 4400 deletions

View File

@@ -1,180 +1,180 @@
package Test;
/* [BPakage.BDatabase]
* Desc: To create Operationnal Database Link fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import java.sql.*;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import org.mariadb.jdbc.*;
import javax.crypto.spec.PSource;
/**
* <p>Methodes pour les interaction avec une base de donnees</p>
*
* @author <a href="https://github.com/lalBi94">Bilal Boudjemline</a>
*/
public class BDatabase {
private final String db_host;
private final String db_name;
private final String db_user;
private final String db_password;
protected Connection sharedObject;
private boolean status;
public BDatabase() {
this.db_host = "jdbc:mariadb://dwarves.iut-fbleau.fr/";
this.db_name = "brinet";
this.db_user = "brinet";
this.db_password = "Aignan41!";
try {
Class.forName("org.mariadb.jdbc.Driver");
} catch(ClassNotFoundException e) {
e.printStackTrace();
}
try {
this.sharedObject = DriverManager.getConnection(this.db_host + this.db_name, this.db_user, this.db_password);
this.status = true;
} catch (SQLException e) {
System.out.println("Erreur de liaison avec la base de donnees.");
}
}
/**
* Recuperer les informations d'un requete de type SELECT.
*
* @param request Le SELECT a faire (il y aura plus d'argument prochainement)
* @return Les resultats engendre par la requete
*/
public ArrayList<String> fetchAll(String request) {
try {
ArrayList<String> toReturn = new ArrayList<String>();
ResultSet rs = this.sharedObject.prepareStatement(request).executeQuery();
for(int i = 0; rs.next(); i++) {
toReturn.add(i, String.valueOf(rs.getString(1)));
}
return toReturn;
} catch(SQLException e) {
System.out.println("Erreur de la requete : " + e);
return null;
}
}
/**
* Insert une ligne dans une table.
*
* @param table La table
* @param col Tableau qui contient les colonnes d'affectation
* @param value Valeur des colonnes
* @return Retourne true si ca a reussit et false dans le cas inverse
*/
public boolean insertRow(String table, String[] col, String[] value) {
StringBuilder collumns = new StringBuilder();
StringBuilder values = new StringBuilder();
Iterator<String> iteCol = Arrays.stream(col).iterator();
Iterator<String> iteVal = Arrays.stream(value).iterator();
collumns.append("(");
while(iteCol.hasNext()) {
collumns.append(iteCol.next()).append(", ");
}
collumns.setLength(collumns.length()-2);
collumns.append(")");
values.append("(");
while(iteVal.hasNext()) {
values.append("\"").append(iteVal.next()).append("\"").append(", ");
}
values.setLength(values.length()-2);
values.append(")");
String request = "INSERT INTO " + table + collumns + " VALUES" + values + ";";
System.out.println(request);
try {
this.sharedObject.prepareStatement(request).executeQuery();
System.out.println("Succes: " + request);
return true;
} catch(SQLException e) {
return false;
}
}
/**
* Faire des requetes de type UPDATE SET (il y aura plus d'argument prochainement).
*
* @param request La requete
* @return Si oui ou non ca a fonctionne
*/
public boolean updateRow(String request) {
try {
this.sharedObject.prepareStatement(request).executeQuery();
System.out.println("Succes: " + request);
return true;
} catch(SQLException e) {
return false;
}
}
/**
* Recuperer l'objet Connection pour pouvoir utiliser ses methodes.
*
* @return L 'objet Connection.
*/
public Connection getSharedObject() {
return this.sharedObject;
}
/**
* Recuperer l'utilisateur courant.
*
* @return L 'utilisateur.
*/
public String getUser() {
return this.db_user;
}
/**
* Recuperer l'hote courant.
*
* @return L 'hote.
*/
public String getHost() {
return this.db_host;
}
/**
* Recuperer le nom de la base de donnees.
*
* @return Le nom de la base de donnees.
*/
public String getDatabaseName() {
return this.db_name;
}
/**
* Recuperer le status de connection.
*
* @return Le status de connection.
*/
public boolean getStatus() {
return this.status;
}
@Override
public String toString() {
return this.db_host + "\n" + this.db_name + "\n" + this.db_user + "\n";
}
package Test;
/* [BPakage.BDatabase]
* Desc: To create Operationnal Database Link fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import java.sql.*;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import org.mariadb.jdbc.*;
import javax.crypto.spec.PSource;
/**
* <p>Methodes pour les interaction avec une base de donnees</p>
*
* @author <a href="https://github.com/lalBi94">Bilal Boudjemline</a>
*/
public class BDatabase {
private final String db_host;
private final String db_name;
private final String db_user;
private final String db_password;
protected Connection sharedObject;
private boolean status;
public BDatabase() {
this.db_host = "jdbc:mariadb://dwarves.iut-fbleau.fr/";
this.db_name = "brinet";
this.db_user = "brinet";
this.db_password = "Aignan41!";
try {
Class.forName("org.mariadb.jdbc.Driver");
} catch(ClassNotFoundException e) {
e.printStackTrace();
}
try {
this.sharedObject = DriverManager.getConnection(this.db_host + this.db_name, this.db_user, this.db_password);
this.status = true;
} catch (SQLException e) {
System.out.println("Erreur de liaison avec la base de donnees.");
}
}
/**
* Recuperer les informations d'un requete de type SELECT.
*
* @param request Le SELECT a faire (il y aura plus d'argument prochainement)
* @return Les resultats engendre par la requete
*/
public ArrayList<String> fetchAll(String request) {
try {
ArrayList<String> toReturn = new ArrayList<String>();
ResultSet rs = this.sharedObject.prepareStatement(request).executeQuery();
for(int i = 0; rs.next(); i++) {
toReturn.add(i, String.valueOf(rs.getString(1)));
}
return toReturn;
} catch(SQLException e) {
System.out.println("Erreur de la requete : " + e);
return null;
}
}
/**
* Insert une ligne dans une table.
*
* @param table La table
* @param col Tableau qui contient les colonnes d'affectation
* @param value Valeur des colonnes
* @return Retourne true si ca a reussit et false dans le cas inverse
*/
public boolean insertRow(String table, String[] col, String[] value) {
StringBuilder collumns = new StringBuilder();
StringBuilder values = new StringBuilder();
Iterator<String> iteCol = Arrays.stream(col).iterator();
Iterator<String> iteVal = Arrays.stream(value).iterator();
collumns.append("(");
while(iteCol.hasNext()) {
collumns.append(iteCol.next()).append(", ");
}
collumns.setLength(collumns.length()-2);
collumns.append(")");
values.append("(");
while(iteVal.hasNext()) {
values.append("\"").append(iteVal.next()).append("\"").append(", ");
}
values.setLength(values.length()-2);
values.append(")");
String request = "INSERT INTO " + table + collumns + " VALUES" + values + ";";
System.out.println(request);
try {
this.sharedObject.prepareStatement(request).executeQuery();
System.out.println("Succes: " + request);
return true;
} catch(SQLException e) {
return false;
}
}
/**
* Faire des requetes de type UPDATE SET (il y aura plus d'argument prochainement).
*
* @param request La requete
* @return Si oui ou non ca a fonctionne
*/
public boolean updateRow(String request) {
try {
this.sharedObject.prepareStatement(request).executeQuery();
System.out.println("Succes: " + request);
return true;
} catch(SQLException e) {
return false;
}
}
/**
* Recuperer l'objet Connection pour pouvoir utiliser ses methodes.
*
* @return L 'objet Connection.
*/
public Connection getSharedObject() {
return this.sharedObject;
}
/**
* Recuperer l'utilisateur courant.
*
* @return L 'utilisateur.
*/
public String getUser() {
return this.db_user;
}
/**
* Recuperer l'hote courant.
*
* @return L 'hote.
*/
public String getHost() {
return this.db_host;
}
/**
* Recuperer le nom de la base de donnees.
*
* @return Le nom de la base de donnees.
*/
public String getDatabaseName() {
return this.db_name;
}
/**
* Recuperer le status de connection.
*
* @return Le status de connection.
*/
public boolean getStatus() {
return this.status;
}
@Override
public String toString() {
return this.db_host + "\n" + this.db_name + "\n" + this.db_user + "\n";
}
}

View File

@@ -1,174 +1,174 @@
package Test;
/* [BPackage.BFrame]
* Desc: To create Operationnal JFrame with utils methods fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.ImageIcon;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.event.WindowEvent;
/**
* <p>Pour creer une fenetre rapidement avec les methodes simplifier</p>
*
* @author <a href="https://github.com/lalBi94">Bilal Boudjemline</a>
*/
public class BFrame extends JFrame {
private final String title;
private int location_x = 1;
private int location_y = 1;
private int width = 500;
private int height = 500;
private int killProcess = 3;
private boolean isOpen = false;
/**
* Avec le titre et mode de fermeture.
*
* @param title Le titre de la fenetre
* @param oC Mode de fermeture de la fenetre
*/
public BFrame(String title, int oC) {
this.title = title;
this.killProcess = oC;
initBFrame();
}
/**
* Avec le titre, la taille (en L et l) et mode de fermeture.
*
* @param titlee Le titre de la fenetre
* @param size_x La longueur de la fenetre
* @param size_y La largeur y de la fenetre
* @param oC Mode de fermeture de la fenetre
*/
public BFrame(String titlee, int size_x, int size_y, int oC) {
this.title = titlee;
this.width = size_x;
this.height = size_y;
this.killProcess = oC;
initBFrame();
}
/**
* Avec le titre, la locasation (en x et y), la taille (en L et l) et mode de fermeture.
*
* @param title Le titre de la fenetre
* @param loca_x La localisation en x de la fenetre
* @param loca_y La localisation en y de la fenetre
* @param size_x La longueur de la fenetre
* @param size_y La largeur de la fenetre
* @param oC Mode de fermeture de la fenetre
*/
public BFrame(String title, int loca_x, int loca_y, int size_x, int size_y, int oC) {
this.title = title;
this.location_x = loca_x;
this.location_y = loca_y;
this.width = size_x;
this.height = size_y;
this.killProcess = oC;
initBFrame();
}
/**
* Avec le titre, la locasation (en x et y), la taille (en L et l), le layout et le mode de fermeture.
*
* @param title Le titre de la fenetre
* @param loca_x La localisation en x de la fenetre
* @param loca_y La localisation en y de la fenetre
* @param size_x La longueur de la fenetre
* @param size_y La largeur de la fenetre
* @param layout Layout a utiliser dispo : GridBagLayout / GridLayout
* @param layout_row the layout row
* @param layout_col the layout col
* @param oC Mode de fermeture de la fenetre
*/
public BFrame(String title, int loca_x, int loca_y, int size_x, int size_y, String layout, int layout_row, int layout_col, int oC) {
this.title = title;
this.location_x = loca_x;
this.location_y = loca_y;
this.width = size_x;
this.height = size_y;
this.killProcess = oC;
initBFrame(layout, layout_row, layout_col);
}
/**
* Initialiser la fenetre sans Layout par def.
*/
protected void initBFrame() {
ImageIcon icon = new ImageIcon("assets/logo.png");
this.setTitle(this.title);
this.setLocation(this.location_x, this.location_y);
this.setSize(this.width, this.height);
this.setLayout(new GridBagLayout());
this.setIconImage(icon.getImage());
this.setDefaultCloseOperation(this.killProcess);
}
/**
* Initialiser la fenetre avec Layout
*
* @param layout the layout
* @param row the row
* @param col the col
*/
protected void initBFrame(String layout, int row, int col) {
ImageIcon icon = new ImageIcon("assets/logo.png");
this.setTitle(this.title);
this.setLocation(this.location_x, this.location_y);
this.setSize(this.width, this.height);
if(layout == "GridLayout") {
this.setLayout(new GridLayout(row, col));
} else {
System.out.println("Un layout doit etre fourni.");
}
this.setIconImage(icon.getImage());
this.setDefaultCloseOperation(this.killProcess);
}
/**
* Ouvrir la fenetre
*/
public void openBFrame() {
this.isOpen = true;
this.setVisible(true);
}
/**
* Fermer la fenetre
*/
public void closeBFrame() {
this.isOpen = false;
this.setVisible(false);
this.dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
}
/**
* Rafraichir la fenetre
*/
public void refreshBFrame() {
SwingUtilities.updateComponentTreeUI(this);
}
/**
* Statut de visibilite de la fenetre
*/
public boolean isVisible() {
return this.isOpen;
}
@Override
public String toString() {
return this.title + ": is opened";
}
package Test;
/* [BPackage.BFrame]
* Desc: To create Operationnal JFrame with utils methods fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.ImageIcon;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.event.WindowEvent;
/**
* <p>Pour creer une fenetre rapidement avec les methodes simplifier</p>
*
* @author <a href="https://github.com/lalBi94">Bilal Boudjemline</a>
*/
public class BFrame extends JFrame {
private final String title;
private int location_x = 1;
private int location_y = 1;
private int width = 500;
private int height = 500;
private int killProcess = 3;
private boolean isOpen = false;
/**
* Avec le titre et mode de fermeture.
*
* @param title Le titre de la fenetre
* @param oC Mode de fermeture de la fenetre
*/
public BFrame(String title, int oC) {
this.title = title;
this.killProcess = oC;
initBFrame();
}
/**
* Avec le titre, la taille (en L et l) et mode de fermeture.
*
* @param titlee Le titre de la fenetre
* @param size_x La longueur de la fenetre
* @param size_y La largeur y de la fenetre
* @param oC Mode de fermeture de la fenetre
*/
public BFrame(String titlee, int size_x, int size_y, int oC) {
this.title = titlee;
this.width = size_x;
this.height = size_y;
this.killProcess = oC;
initBFrame();
}
/**
* Avec le titre, la locasation (en x et y), la taille (en L et l) et mode de fermeture.
*
* @param title Le titre de la fenetre
* @param loca_x La localisation en x de la fenetre
* @param loca_y La localisation en y de la fenetre
* @param size_x La longueur de la fenetre
* @param size_y La largeur de la fenetre
* @param oC Mode de fermeture de la fenetre
*/
public BFrame(String title, int loca_x, int loca_y, int size_x, int size_y, int oC) {
this.title = title;
this.location_x = loca_x;
this.location_y = loca_y;
this.width = size_x;
this.height = size_y;
this.killProcess = oC;
initBFrame();
}
/**
* Avec le titre, la locasation (en x et y), la taille (en L et l), le layout et le mode de fermeture.
*
* @param title Le titre de la fenetre
* @param loca_x La localisation en x de la fenetre
* @param loca_y La localisation en y de la fenetre
* @param size_x La longueur de la fenetre
* @param size_y La largeur de la fenetre
* @param layout Layout a utiliser dispo : GridBagLayout / GridLayout
* @param layout_row the layout row
* @param layout_col the layout col
* @param oC Mode de fermeture de la fenetre
*/
public BFrame(String title, int loca_x, int loca_y, int size_x, int size_y, String layout, int layout_row, int layout_col, int oC) {
this.title = title;
this.location_x = loca_x;
this.location_y = loca_y;
this.width = size_x;
this.height = size_y;
this.killProcess = oC;
initBFrame(layout, layout_row, layout_col);
}
/**
* Initialiser la fenetre sans Layout par def.
*/
protected void initBFrame() {
ImageIcon icon = new ImageIcon("assets/logo.png");
this.setTitle(this.title);
this.setLocation(this.location_x, this.location_y);
this.setSize(this.width, this.height);
this.setLayout(new GridBagLayout());
this.setIconImage(icon.getImage());
this.setDefaultCloseOperation(this.killProcess);
}
/**
* Initialiser la fenetre avec Layout
*
* @param layout the layout
* @param row the row
* @param col the col
*/
protected void initBFrame(String layout, int row, int col) {
ImageIcon icon = new ImageIcon("assets/logo.png");
this.setTitle(this.title);
this.setLocation(this.location_x, this.location_y);
this.setSize(this.width, this.height);
if(layout == "GridLayout") {
this.setLayout(new GridLayout(row, col));
} else {
System.out.println("Un layout doit etre fourni.");
}
this.setIconImage(icon.getImage());
this.setDefaultCloseOperation(this.killProcess);
}
/**
* Ouvrir la fenetre
*/
public void openBFrame() {
this.isOpen = true;
this.setVisible(true);
}
/**
* Fermer la fenetre
*/
public void closeBFrame() {
this.isOpen = false;
this.setVisible(false);
this.dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
}
/**
* Rafraichir la fenetre
*/
public void refreshBFrame() {
SwingUtilities.updateComponentTreeUI(this);
}
/**
* Statut de visibilite de la fenetre
*/
public boolean isVisible() {
return this.isOpen;
}
@Override
public String toString() {
return this.title + ": is opened";
}
}

View File

@@ -1,171 +1,171 @@
package Test;
/* [BPakage.BLayout]
* Desc: To create a layout fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import java.awt.GridBagConstraints;
import java.awt.Insets;
/**
* <p>Pour creer un layout de type GridBagLayout rapidement avec les methodes simplifier.</p>
*
* @author <a href="https://github.com/lalBi94">Bilal Boudjemline</a>
*/
public class BLayout extends GridBagConstraints {
public int PositionOnX = 0;
public int PositionOnY = 0;
public int takeCaseOnX = 1;
public int takeCaseOnY = 1;
public double sizeOnX = 0.0f;
public double sizeOnY = 0.0f;
public int padding_top = 1;
public int padding_left = 1;
public int padding_bottom = 1;
public int padding_right = 1;
public Insets padding = new Insets(this.padding_top, this.padding_left, this.padding_bottom, this.padding_right);
public int positionOnScreen = GridBagConstraints.NORTH;
public int filler = GridBagConstraints.BASELINE;
public BLayout() {
initLayout();
}
/**
* @param positionX Position en X.
* @param positionY Position en y.
* @param manyCaseX Combien le component prend de case en x.
* @param manyCaseY Combien le component prend de case en y.
* @param sizeX Taille en double en x.
* @param sizeY Taille en double en y.
* @param pad Le padding.
* @param positionOnScreen La position sur la frame (centre, north etc...).
* @param filling Remplissage (H, V, B).
*/
public BLayout(int positionX, int positionY, int manyCaseX, int manyCaseY, double sizeX,
double sizeY, Insets pad, int positionOnScreen, int filling) {
this.PositionOnX = positionX;
this.PositionOnY = positionY;
this.takeCaseOnX = manyCaseX;
this.takeCaseOnY = manyCaseY;
this.sizeOnX = sizeX;
this.sizeOnY = sizeY;
this.padding_top = pad.top;
this.padding_left = pad.left;
this.padding_bottom = pad.bottom;
this.padding_right = pad.right;
this.padding = pad;
this.positionOnScreen = positionOnScreen;
this.filler = filling;
initLayout();
}
/**
* Initialiser le layout pour le changer dans GridBagConstraint (Valeur attribuer par def.).
* */
private void initLayout() {
this.gridx = this.PositionOnX;
this.gridy = this.PositionOnY;
this.gridheight = this.takeCaseOnX;
this.gridwidth = this.takeCaseOnY;
this.weightx = this.sizeOnX;
this.weighty = this.sizeOnY;
this.insets = this.padding;
this.anchor = this.positionOnScreen;
this.fill = this.filler;
}
/**
* Changer le cuseur en x.
*
* @param by par quoi
*/
public void setPositionX(int by) {
this.PositionOnX = by;
initLayout();
}
/**
* Changer le cuseur en y.
*
* @param by par quoi
*/
public void setPositionY(int by) {
this.PositionOnY = by;
initLayout();
}
/**
* Changer la place occupe en x.
*
* @param by par quoi
*/
public void setTakeCaseOnX(int by) {
this.takeCaseOnX = by;
initLayout();
}
/**
* Changer la place occupe en y.
*
* @param by par quoi
*/
public void setTakeCaseOnY(int by) {
this.takeCaseOnY = by;
initLayout();
}
/**
* Mettre sa taille en x.
*
* @param by par quoi
*/
public void setSizeX(double by) {
this.sizeOnX = by;
initLayout();
}
/**
* Mettre sa taille en y.
*
* @param by par quoi
*/
public void setSizeY(double by) {
this.sizeOnY = by;
initLayout();
}
/**
* Mettre un padding.
*
* @param by par quoi
*/
public void setPadding(Insets by) {
this.padding = by;
initLayout();
}
/**
* Mettre une ancre.
*
* @param by par quoi
*/
public void setAnchor(int by) {
this.positionOnScreen = by;
initLayout();
}
/**
* Mettre un remplissage.
*
* @param by par quoi
*/
public void setFill(int by) {
this.filler = by;
initLayout();
}
}
package Test;
/* [BPakage.BLayout]
* Desc: To create a layout fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import java.awt.GridBagConstraints;
import java.awt.Insets;
/**
* <p>Pour creer un layout de type GridBagLayout rapidement avec les methodes simplifier.</p>
*
* @author <a href="https://github.com/lalBi94">Bilal Boudjemline</a>
*/
public class BLayout extends GridBagConstraints {
public int PositionOnX = 0;
public int PositionOnY = 0;
public int takeCaseOnX = 1;
public int takeCaseOnY = 1;
public double sizeOnX = 0.0f;
public double sizeOnY = 0.0f;
public int padding_top = 1;
public int padding_left = 1;
public int padding_bottom = 1;
public int padding_right = 1;
public Insets padding = new Insets(this.padding_top, this.padding_left, this.padding_bottom, this.padding_right);
public int positionOnScreen = GridBagConstraints.NORTH;
public int filler = GridBagConstraints.BASELINE;
public BLayout() {
initLayout();
}
/**
* @param positionX Position en X.
* @param positionY Position en y.
* @param manyCaseX Combien le component prend de case en x.
* @param manyCaseY Combien le component prend de case en y.
* @param sizeX Taille en double en x.
* @param sizeY Taille en double en y.
* @param pad Le padding.
* @param positionOnScreen La position sur la frame (centre, north etc...).
* @param filling Remplissage (H, V, B).
*/
public BLayout(int positionX, int positionY, int manyCaseX, int manyCaseY, double sizeX,
double sizeY, Insets pad, int positionOnScreen, int filling) {
this.PositionOnX = positionX;
this.PositionOnY = positionY;
this.takeCaseOnX = manyCaseX;
this.takeCaseOnY = manyCaseY;
this.sizeOnX = sizeX;
this.sizeOnY = sizeY;
this.padding_top = pad.top;
this.padding_left = pad.left;
this.padding_bottom = pad.bottom;
this.padding_right = pad.right;
this.padding = pad;
this.positionOnScreen = positionOnScreen;
this.filler = filling;
initLayout();
}
/**
* Initialiser le layout pour le changer dans GridBagConstraint (Valeur attribuer par def.).
* */
private void initLayout() {
this.gridx = this.PositionOnX;
this.gridy = this.PositionOnY;
this.gridheight = this.takeCaseOnX;
this.gridwidth = this.takeCaseOnY;
this.weightx = this.sizeOnX;
this.weighty = this.sizeOnY;
this.insets = this.padding;
this.anchor = this.positionOnScreen;
this.fill = this.filler;
}
/**
* Changer le cuseur en x.
*
* @param by par quoi
*/
public void setPositionX(int by) {
this.PositionOnX = by;
initLayout();
}
/**
* Changer le cuseur en y.
*
* @param by par quoi
*/
public void setPositionY(int by) {
this.PositionOnY = by;
initLayout();
}
/**
* Changer la place occupe en x.
*
* @param by par quoi
*/
public void setTakeCaseOnX(int by) {
this.takeCaseOnX = by;
initLayout();
}
/**
* Changer la place occupe en y.
*
* @param by par quoi
*/
public void setTakeCaseOnY(int by) {
this.takeCaseOnY = by;
initLayout();
}
/**
* Mettre sa taille en x.
*
* @param by par quoi
*/
public void setSizeX(double by) {
this.sizeOnX = by;
initLayout();
}
/**
* Mettre sa taille en y.
*
* @param by par quoi
*/
public void setSizeY(double by) {
this.sizeOnY = by;
initLayout();
}
/**
* Mettre un padding.
*
* @param by par quoi
*/
public void setPadding(Insets by) {
this.padding = by;
initLayout();
}
/**
* Mettre une ancre.
*
* @param by par quoi
*/
public void setAnchor(int by) {
this.positionOnScreen = by;
initLayout();
}
/**
* Mettre un remplissage.
*
* @param by par quoi
*/
public void setFill(int by) {
this.filler = by;
initLayout();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,71 +1,71 @@
package Test;
import API.*;
import MNP.*;
import java.util.ArrayList;
public class TestTexteMNP {
public static void main(String[] args) {
/**
* Objet de la base de donnee contenant des methodes utile a notre developpement
* */
BDatabase bd = new BDatabase();
/**
* Chargement des eleves
* */
ArrayList<Etudiant> listEtu = new ArrayList<>();
ArrayList<String> studPrenom = bd.fetchAll("SELECT prenom FROM fi_eleves");
ArrayList<String> studNom = bd.fetchAll("SELECT nom FROM fi_eleves");
ArrayList<String> studGroupe = bd.fetchAll("SELECT groupe FROM fi_eleves");
for(int i = 0; i <= studPrenom.size()-1; i++) {
if(studPrenom.get(i) != null && studNom.get(i) != null && studGroupe.get(i) != null) {
listEtu.add(
new EtudiantNP(
studNom.get(i),
studPrenom.get(i),
Integer.parseInt(studGroupe.get(i), 10)
)
);
} else {
System.out.println("[!] Erreur lors du chargement de la liste des etudiants.");
System.exit(-1);
}
}
System.out.println("[+] Liste des etudiants chargees.");
/**
* Chargement des groupes
* */
ArrayList<Groupe> listGroupe = new ArrayList<>();
ArrayList<String> groupeId = bd.fetchAll("SELECT id FROM fi_groupe");
ArrayList<String> groupeNom = bd.fetchAll("SELECT nom FROM fi_groupe");
ArrayList<String> groupeMin = bd.fetchAll("SELECT min FROM fi_groupe");
ArrayList<String> groupeMax = bd.fetchAll("SELECT max FROM fi_groupe");
for(int i = 0; i <= groupeNom.size()-1; i++) {
if(groupeId.get(i) != null && groupeNom.get(i) != null && groupeMin.get(i) != null && groupeMax.get(i) != null) {
listGroupe.add(
new GroupeNP(
Integer.parseInt(groupeId.get(i), 10),
groupeNom.get(i),
Integer.parseInt(groupeMin.get(i), 10),
Integer.parseInt(groupeMax.get(i), 10)
)
);
} else {
System.out.println("[!] Erreur lors du chargement de la liste des groupes.");
System.exit(-1);
}
}
System.out.println("[+] Liste des groupes chargees.");
/**
* Redirection vers ProfView (vue professeur)
* */
new ProfView(listEtu, listGroupe, bd);
}
}
package Test;
import API.*;
import MNP.*;
import java.util.ArrayList;
public class TestTexteMNP {
public static void main(String[] args) {
/**
* Objet de la base de donnee contenant des methodes utile a notre developpement
* */
BDatabase bd = new BDatabase();
/**
* Chargement des eleves
* */
ArrayList<Etudiant> listEtu = new ArrayList<>();
ArrayList<String> studPrenom = bd.fetchAll("SELECT prenom FROM fi_eleves");
ArrayList<String> studNom = bd.fetchAll("SELECT nom FROM fi_eleves");
ArrayList<String> studGroupe = bd.fetchAll("SELECT groupe FROM fi_eleves");
for(int i = 0; i <= studPrenom.size()-1; i++) {
if(studPrenom.get(i) != null && studNom.get(i) != null && studGroupe.get(i) != null) {
listEtu.add(
new EtudiantNP(
studNom.get(i),
studPrenom.get(i),
Integer.parseInt(studGroupe.get(i), 10)
)
);
} else {
System.out.println("[!] Erreur lors du chargement de la liste des etudiants.");
System.exit(-1);
}
}
System.out.println("[+] Liste des etudiants chargees.");
/**
* Chargement des groupes
* */
ArrayList<Groupe> listGroupe = new ArrayList<>();
ArrayList<String> groupeId = bd.fetchAll("SELECT id FROM fi_groupe");
ArrayList<String> groupeNom = bd.fetchAll("SELECT nom FROM fi_groupe");
ArrayList<String> groupeMin = bd.fetchAll("SELECT min FROM fi_groupe");
ArrayList<String> groupeMax = bd.fetchAll("SELECT max FROM fi_groupe");
for(int i = 0; i <= groupeNom.size()-1; i++) {
if(groupeId.get(i) != null && groupeNom.get(i) != null && groupeMin.get(i) != null && groupeMax.get(i) != null) {
listGroupe.add(
new GroupeNP(
Integer.parseInt(groupeId.get(i), 10),
groupeNom.get(i),
Integer.parseInt(groupeMin.get(i), 10),
Integer.parseInt(groupeMax.get(i), 10)
)
);
} else {
System.out.println("[!] Erreur lors du chargement de la liste des groupes.");
System.exit(-1);
}
}
System.out.println("[+] Liste des groupes chargees.");
/**
* Redirection vers ProfView (vue professeur)
* */
new ProfView(listEtu, listGroupe, bd);
}
}