la page de resulstat a ete deplacée dans une nouvelle fenetre, ajouts de quelques element de styles + fix des evenement liées a l'interaction avec la carte
This commit is contained in:
parent
b73c6403aa
commit
42b845d73a
@ -23,13 +23,19 @@ public class Donnees {
|
|||||||
return academieSelectionee;
|
return academieSelectionee;
|
||||||
}
|
}
|
||||||
public static void setAcademieSelectionee(Academie academieSelectionee) {
|
public static void setAcademieSelectionee(Academie academieSelectionee) {
|
||||||
System.out.println("Academie Selectionée : %s".formatted(academieSelectionee.getNom()));
|
if (academieSelectionee.equals(Donnees.academieSelectionee)){
|
||||||
|
academieSelectionee = null;
|
||||||
|
}
|
||||||
|
System.out.println("Academie Selectionée : %s".formatted((academieSelectionee == null)?"Aucune academie":academieSelectionee.getNom()));
|
||||||
Donnees.academieSelectionee = academieSelectionee;
|
Donnees.academieSelectionee = academieSelectionee;
|
||||||
}
|
}
|
||||||
public static Thematique getThematiqueSelectionee() {
|
public static Thematique getThematiqueSelectionee() {
|
||||||
return thematiqueSelectionee;
|
return thematiqueSelectionee;
|
||||||
}
|
}
|
||||||
public static void setThematiqueSelectionee(Thematique thematiqueSelectionee) {
|
public static void setThematiqueSelectionee(Thematique thematiqueSelectionee) {
|
||||||
|
if(thematiqueSelectionee == Donnees.thematiqueSelectionee){
|
||||||
|
thematiqueSelectionee = null;
|
||||||
|
}
|
||||||
System.out.println("Thematique selectionée : %s".formatted((thematiqueSelectionee == null)? "Aucune Thematique" : thematiqueSelectionee.getNom()));
|
System.out.println("Thematique selectionée : %s".formatted((thematiqueSelectionee == null)? "Aucune Thematique" : thematiqueSelectionee.getNom()));
|
||||||
Donnees.thematiqueSelectionee = thematiqueSelectionee;
|
Donnees.thematiqueSelectionee = thematiqueSelectionee;
|
||||||
}
|
}
|
||||||
@ -37,9 +43,13 @@ public class Donnees {
|
|||||||
return disciplineSelectionee;
|
return disciplineSelectionee;
|
||||||
}
|
}
|
||||||
public static void setDisciplineSelectionee(Discipline disciplineSelectionee) {
|
public static void setDisciplineSelectionee(Discipline disciplineSelectionee) {
|
||||||
|
if(disciplineSelectionee == Donnees.disciplineSelectionee){
|
||||||
|
disciplineSelectionee = Discipline.Toutes;
|
||||||
|
}
|
||||||
System.out.println("Discipline Selectionee : %s".formatted(disciplineSelectionee.getNom()));
|
System.out.println("Discipline Selectionee : %s".formatted(disciplineSelectionee.getNom()));
|
||||||
Donnees.disciplineSelectionee = disciplineSelectionee;
|
Donnees.disciplineSelectionee = disciplineSelectionee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,24 +20,14 @@ public class Main extends Application {
|
|||||||
private ScreenController gestionnaireDePages = new ScreenController(scene);
|
private ScreenController gestionnaireDePages = new ScreenController(scene);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws IOException {
|
public void start(Stage stage) throws IOException{
|
||||||
france = FranceBuilder.create()
|
|
||||||
.selectedColor(Color.MAGENTA)
|
|
||||||
.mousePressHandler(evt -> {
|
|
||||||
AcademiePath academiePath = (AcademiePath) evt.getSource();
|
|
||||||
Donnees.setAcademieSelectionee(academiePath.getAcademie());
|
|
||||||
})
|
|
||||||
.selectionEnabled(true)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
|
|
||||||
ScreenController.addScreen("Acceuil",FXMLLoader.load(getClass().getResource("/fr/univ_amu/iut/fp/fp.fxml")));
|
ScreenController.addScreen("Acceuil",FXMLLoader.load(getClass().getResource("/fr/univ_amu/iut/fp/fp.fxml")));
|
||||||
ScreenController.addScreen("Resultats",FXMLLoader.load(getClass().getResource("/fr/univ_amu/iut/fResultat/FResultat.fxml")));;
|
|
||||||
ScreenController.activate("Acceuil");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
//TODO Ajouter les pages d'admin pour l'ajout des usages
|
||||||
public void start(Stage stage){
|
//ScreenController.addScreen("admin1",pane);
|
||||||
|
//ScreenController.addScreen("admin2",pane);
|
||||||
|
|
||||||
|
ScreenController.activate("Acceuil");
|
||||||
stage.setTitle("Carte des académie");
|
stage.setTitle("Carte des académie");
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.show();
|
stage.show();
|
||||||
|
@ -14,8 +14,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
import fr.univ_amu.iut.Donnees;
|
import fr.univ_amu.iut.Donnees;
|
||||||
import fr.univ_amu.iut.model.Discipline;
|
|
||||||
import fr.univ_amu.iut.model.Niveau;
|
|
||||||
import fr.univ_amu.iut.model.Usage;
|
import fr.univ_amu.iut.model.Usage;
|
||||||
|
|
||||||
public class Controller implements Initializable{
|
public class Controller implements Initializable{
|
||||||
@ -39,14 +37,12 @@ public class Controller implements Initializable{
|
|||||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||||
|
|
||||||
|
|
||||||
// TODO MOVE THIS INTO A LISTENER THAT ACTUALLY WORKS
|
List<TableEntry> entries = new ArrayList<>();
|
||||||
// List<TableEntry> entries = new ArrayList<>();
|
for (Usage usage: Donnees.getUsagesObtenus()){
|
||||||
// for (Usage usage: Donnees.getUsagesObtenus()){
|
entries.add(new TableEntry(usage));
|
||||||
// entries.add(new TableEntry(usage));
|
}
|
||||||
// }
|
ObservableList<TableEntry> tableEntries = FXCollections.observableArrayList(entries);
|
||||||
// ObservableList<TableEntry> tableEntries = FXCollections.observableArrayList(entries);
|
table.setItems(tableEntries);
|
||||||
|
|
||||||
// table.setItems(tableEntries);
|
|
||||||
|
|
||||||
nom.setCellValueFactory(new PropertyValueFactory<TableEntry, String>("nom"));
|
nom.setCellValueFactory(new PropertyValueFactory<TableEntry, String>("nom"));
|
||||||
discipline.setCellValueFactory(new PropertyValueFactory<TableEntry, String>("discipline"));
|
discipline.setCellValueFactory(new PropertyValueFactory<TableEntry, String>("discipline"));
|
||||||
|
@ -11,25 +11,31 @@ import fr.univ_amu.iut.dao.factory.DAOType;
|
|||||||
import fr.univ_amu.iut.model.Discipline;
|
import fr.univ_amu.iut.model.Discipline;
|
||||||
import fr.univ_amu.iut.model.Thematique;
|
import fr.univ_amu.iut.model.Thematique;
|
||||||
import fr.univ_amu.iut.screenController.ScreenController;
|
import fr.univ_amu.iut.screenController.ScreenController;
|
||||||
|
import fr.univ_amu.iut.view.map.AcademiePath;
|
||||||
import fr.univ_amu.iut.view.map.France;
|
import fr.univ_amu.iut.view.map.France;
|
||||||
import fr.univ_amu.iut.view.map.FranceBuilder;
|
import fr.univ_amu.iut.view.map.FranceBuilder;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.layout.*;
|
import javafx.scene.layout.*;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.stage.Stage;
|
||||||
import javafx.event.EventHandler;
|
import javafx.event.EventHandler;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
public class Controller implements Initializable {
|
public class Controller implements Initializable {
|
||||||
France france;
|
France france;
|
||||||
|
EventHandler<MouseEvent> onEnterHandler;
|
||||||
|
EventHandler<MouseEvent> onExitHandler;
|
||||||
DAOFactory daoFactory;
|
DAOFactory daoFactory;
|
||||||
DAODiscipline daoDiscipline;
|
DAODiscipline daoDiscipline;
|
||||||
DAOThematique daoThematique;
|
DAOThematique daoThematique;
|
||||||
@ -47,53 +53,62 @@ public class Controller implements Initializable {
|
|||||||
@FXML
|
@FXML
|
||||||
private Button recherche;
|
private Button recherche;
|
||||||
|
|
||||||
|
// Style des boutons
|
||||||
|
Background btNormalBackground = new Background(new BackgroundFill(Color.rgb(255,110,64), new CornerRadii(30), Insets.EMPTY));
|
||||||
|
Background btNormalHover = new Background(new BackgroundFill(Color.rgb(255,152,120), new CornerRadii(30), Insets.EMPTY));
|
||||||
|
Background btNormalSelected = new Background(new BackgroundFill(Color.rgb(255,60,0), new CornerRadii(30), Insets.EMPTY));
|
||||||
|
|
||||||
private void initFrance() {
|
private void initFrance() {
|
||||||
france = FranceBuilder.create()
|
france = FranceBuilder.create()
|
||||||
.backgroundColor(Color.web("#f5f0e1"))
|
.backgroundColor(Color.web("#f5f0e1"))
|
||||||
.fillColor(Color.web("#1e3d59"))
|
.fillColor(Color.web("#1e3d59"))
|
||||||
// .strokeColor(Color.web("#987028"))
|
.mousePressHandler(evt -> {
|
||||||
// .hoverColor(Color.web("#fec47e"))
|
AcademiePath academiePath = (AcademiePath) evt.getSource();
|
||||||
// .pressedColor(Color.web("#6cee85"))
|
Donnees.setAcademieSelectionee(academiePath.getAcademie());
|
||||||
// .selectedColor(Color.MAGENTA)
|
})
|
||||||
// .mousePressHandler(evt -> {
|
|
||||||
// AcademiePath academiePath = (AcademiePath) evt.getSource();
|
|
||||||
// System.out.println("On vient de cliquer sur l'"+academiePath.getAcademie().getNom());
|
|
||||||
// })
|
|
||||||
.selectionEnabled(true)
|
.selectionEnabled(true)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*<Button layoutX="38.0" layoutY="30.0" mnemonicParsing="false" prefHeight="115.0" prefWidth="235.0" style="-fx-background-radius: 30; -fx-background-color: #ff6e40;" text="Button" />
|
|
||||||
<Button layoutX="332.0" layoutY="30.0" mnemonicParsing="false" prefHeight="115.0" prefWidth="235.0" style="-fx-background-radius: 30; -fx-background-color: #ff6e40#ff6e40;" text="Button" />*/
|
|
||||||
|
|
||||||
|
|
||||||
private Button initButton(Object obj,int x,int y){
|
private Button initButton(Object obj,int x,int y){
|
||||||
String nom = "";
|
String nom = "";
|
||||||
EventHandler<ActionEvent> handler;
|
|
||||||
|
EventHandler<ActionEvent> actionHandler;
|
||||||
|
EventHandler<MouseEvent> onPressHandler;
|
||||||
|
|
||||||
|
onEnterHandler = evt -> {
|
||||||
|
Button bt = (Button) evt.getSource();
|
||||||
|
bt.setBackground(btNormalHover);
|
||||||
|
};
|
||||||
|
|
||||||
|
onExitHandler= evt -> {
|
||||||
|
Button bt = (Button) evt.getSource();
|
||||||
|
bt.setBackground(btNormalBackground);
|
||||||
|
};
|
||||||
|
|
||||||
|
onPressHandler = event -> {
|
||||||
|
Button bt = (Button) event.getSource();
|
||||||
|
if(bt.getBackground().equals(btNormalSelected)){
|
||||||
|
bt.setBackground(btNormalHover);
|
||||||
|
bt.setOnMouseEntered(onEnterHandler);
|
||||||
|
bt.setOnMouseExited(onExitHandler);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
bt.setBackground(btNormalSelected);
|
||||||
|
bt.setOnMouseEntered(null);
|
||||||
|
bt.setOnMouseExited(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if ( obj instanceof Discipline ){
|
if ( obj instanceof Discipline ){
|
||||||
Discipline disciplineActuelle = (Discipline) obj;
|
Discipline disciplineActuelle = (Discipline) obj;
|
||||||
nom = disciplineActuelle.getNom();
|
nom = disciplineActuelle.getNom();
|
||||||
handler = event -> {
|
actionHandler = event -> {Donnees.setDisciplineSelectionee(disciplineActuelle);};
|
||||||
if (Donnees.getDisciplineSelectionee().equals(disciplineActuelle)){
|
|
||||||
Donnees.setDisciplineSelectionee(Discipline.Toutes);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Donnees.setDisciplineSelectionee(disciplineActuelle);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Thematique thematiqueActuelle = (Thematique) obj;
|
Thematique thematiqueActuelle = (Thematique) obj;
|
||||||
handler = event -> {
|
|
||||||
if (Donnees.getThematiqueSelectionee() == null || !(Donnees.getThematiqueSelectionee().equals(obj))){
|
|
||||||
Donnees.setThematiqueSelectionee(thematiqueActuelle);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Donnees.setThematiqueSelectionee(null);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
nom = thematiqueActuelle.getNom();
|
nom = thematiqueActuelle.getNom();
|
||||||
|
actionHandler = event -> {Donnees.setThematiqueSelectionee(thematiqueActuelle);};
|
||||||
}
|
}
|
||||||
|
|
||||||
Button bt = new Button(nom);
|
Button bt = new Button(nom);
|
||||||
@ -105,8 +120,11 @@ public class Controller implements Initializable {
|
|||||||
bt.prefHeight(115);
|
bt.prefHeight(115);
|
||||||
bt.prefWidth(235);
|
bt.prefWidth(235);
|
||||||
bt.setText(nom);
|
bt.setText(nom);
|
||||||
bt.setBackground(new Background(new BackgroundFill(Color.rgb(255,110,64), new CornerRadii(30), Insets.EMPTY)));
|
bt.setBackground(btNormalBackground);
|
||||||
bt.setOnAction(handler);
|
bt.setOnAction(actionHandler);
|
||||||
|
bt.setOnMouseClicked(onPressHandler);
|
||||||
|
bt.setOnMouseEntered(onEnterHandler);
|
||||||
|
bt.setOnMouseExited(onExitHandler);
|
||||||
return bt;
|
return bt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,10 +179,15 @@ public class Controller implements Initializable {
|
|||||||
//TODO Recherche en fonctions des objets selectionnés
|
//TODO Recherche en fonctions des objets selectionnés
|
||||||
Donnees.setUsagesObtenus(daoUsage.findAll());
|
Donnees.setUsagesObtenus(daoUsage.findAll());
|
||||||
|
|
||||||
ScreenController.activate("Resultats");
|
Stage resultats = new Stage();
|
||||||
|
try {
|
||||||
|
resultats.setScene(new Scene(FXMLLoader.load(getClass().getResource("/fr/univ_amu/iut/fResultat/FResultat.fxml"))));
|
||||||
|
resultats.show();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
recherche.setOnAction(handler);
|
recherche.setOnAction(handler);
|
||||||
// matiere.getChildren().add(initButton(t.get(0).getNom(),38,30));
|
|
||||||
// matiere.getChildren().add(initButton("test",38,160));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user