2023-04-26 17:35:23 +02:00
|
|
|
import javax.swing.CellEditor;
|
2023-04-23 23:34:51 +02:00
|
|
|
|
2023-04-26 17:35:23 +02:00
|
|
|
public class Affichage {
|
2023-04-23 23:34:51 +02:00
|
|
|
private Cellules cetteCellules;
|
|
|
|
private PanneauModification cePanel;
|
|
|
|
|
|
|
|
private boolean cetEtat;
|
|
|
|
|
|
|
|
private int[] caseEntrortie;
|
|
|
|
|
|
|
|
public Affichage(Cellules uneCellules, PanneauModification unPanel, int[] tabEntre, boolean unEtat){
|
|
|
|
this.cetteCellules = uneCellules;
|
|
|
|
this.cePanel = unPanel;
|
|
|
|
this.cetEtat = unEtat;
|
|
|
|
this.caseEntrortie = tabEntre;
|
|
|
|
|
|
|
|
repaint();
|
|
|
|
}
|
|
|
|
|
|
|
|
public int[] getGateState(){
|
|
|
|
return this.caseEntrortie;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void repaint(){
|
|
|
|
// Accéder aux boutons radios de l'objet Options
|
|
|
|
boolean radio1Selected = this.cePanel.GetButtonBW().isSelected(); // MUR / COULOIR
|
|
|
|
boolean radio2Selected = this.cePanel.GetButtonE().isSelected(); // ENTREE
|
|
|
|
boolean radio3Selected = this.cePanel.GetButtonS().isSelected(); //SORTIE
|
|
|
|
|
2023-04-26 17:35:23 +02:00
|
|
|
//System.out.println("le type de la cell vaut : " + this.cetteCellules.getType());
|
|
|
|
|
|
|
|
//System.out.println("Etat des deux valeur : " + this.caseEntrortie[0] + " "+ this.caseEntrortie[1]);
|
|
|
|
|
2023-04-23 23:34:51 +02:00
|
|
|
if(radio2Selected==true && this.caseEntrortie[0]==0){
|
2023-04-26 17:35:23 +02:00
|
|
|
this.cetEtat=ModificationsTab.LIBRE;
|
2023-04-26 13:13:15 +02:00
|
|
|
this.cetteCellules.setType(Cellules.ENTREE);
|
|
|
|
this.cetteCellules.peindre(Cellules.ENTREE);
|
2023-04-26 17:35:23 +02:00
|
|
|
this.caseEntrortie[0]=1;
|
2023-04-23 23:34:51 +02:00
|
|
|
} else if(radio3Selected==true && this.caseEntrortie[1]==0){
|
2023-04-26 17:35:23 +02:00
|
|
|
this.cetEtat=ModificationsTab.LIBRE;
|
2023-04-26 13:13:15 +02:00
|
|
|
this.cetteCellules.setType(Cellules.SORTIE);
|
|
|
|
this.cetteCellules.peindre(Cellules.SORTIE);
|
2023-04-26 17:35:23 +02:00
|
|
|
this.caseEntrortie[1]=1;
|
|
|
|
} else if(this.cetEtat == ModificationsTab.LIBRE && radio1Selected==true){
|
|
|
|
if(this.cetteCellules.getType()==Cellules.ENTREE){
|
2023-04-23 23:34:51 +02:00
|
|
|
this.caseEntrortie[0]=0;
|
2023-04-26 17:35:23 +02:00
|
|
|
} else if(this.cetteCellules.getType()==Cellules.SORTIE){
|
2023-04-23 23:34:51 +02:00
|
|
|
this.caseEntrortie[1]=0;
|
|
|
|
}
|
2023-04-26 13:13:15 +02:00
|
|
|
this.cetteCellules.setType(Cellules.COULOIR);
|
|
|
|
this.cetteCellules.peindre(Cellules.COULOIR);
|
2023-04-26 17:35:23 +02:00
|
|
|
} else if(this.cetEtat == ModificationsTab.OCCUPE && radio1Selected==true){
|
2023-04-26 13:13:15 +02:00
|
|
|
this.cetteCellules.setType(Cellules.MUR);
|
|
|
|
this.cetteCellules.peindre(Cellules.MUR);
|
2023-04-23 23:34:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|