il y a un bug le hover reste sur les button deja selectionne
This commit is contained in:
parent
4a0793217a
commit
c31fa88d68
@ -2,7 +2,6 @@ package fr.univ_amu.iut.fp;
|
|||||||
|
|
||||||
import fr.univ_amu.iut.Donnees;
|
import fr.univ_amu.iut.Donnees;
|
||||||
import fr.univ_amu.iut.dao.DAODiscipline;
|
import fr.univ_amu.iut.dao.DAODiscipline;
|
||||||
import fr.univ_amu.iut.dao.DAORessource;
|
|
||||||
import fr.univ_amu.iut.dao.DAOThematique;
|
import fr.univ_amu.iut.dao.DAOThematique;
|
||||||
import fr.univ_amu.iut.dao.DAOUsage;
|
import fr.univ_amu.iut.dao.DAOUsage;
|
||||||
import fr.univ_amu.iut.dao.factory.DAOFactory;
|
import fr.univ_amu.iut.dao.factory.DAOFactory;
|
||||||
@ -10,7 +9,6 @@ import fr.univ_amu.iut.dao.factory.DAOFactoryProducer;
|
|||||||
import fr.univ_amu.iut.dao.factory.DAOType;
|
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.view.map.AcademiePath;
|
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;
|
||||||
@ -29,6 +27,7 @@ import javafx.event.ActionEvent;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
@ -53,67 +52,87 @@ public class Controller implements Initializable {
|
|||||||
@FXML
|
@FXML
|
||||||
private Button recherche;
|
private Button recherche;
|
||||||
|
|
||||||
|
List<String> listNomThematique = new ArrayList<>();
|
||||||
|
|
||||||
// Style des boutons
|
// Style des boutons
|
||||||
Background btNormalBackground = new Background(new BackgroundFill(Color.rgb(255,110,64), new CornerRadii(30), Insets.EMPTY));
|
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 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));
|
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"))
|
||||||
.mousePressHandler(evt -> {
|
.mousePressHandler(evt -> {
|
||||||
AcademiePath academiePath = (AcademiePath) evt.getSource();
|
AcademiePath academiePath = (AcademiePath) evt.getSource();
|
||||||
Donnees.setAcademieSelectionee(academiePath.getAcademie());
|
Donnees.setAcademieSelectionee(academiePath.getAcademie());
|
||||||
})
|
})
|
||||||
.selectionEnabled(true)
|
.selectionEnabled(true)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Button initButton(Object obj,int x,int y){
|
private Button initButton(Object obj, int x, int y) {
|
||||||
String nom = "";
|
String nom = "";
|
||||||
|
|
||||||
EventHandler<ActionEvent> actionHandler;
|
EventHandler<ActionEvent> actionHandler;
|
||||||
EventHandler<MouseEvent> onPressHandler;
|
EventHandler<MouseEvent> onPressHandler;
|
||||||
|
|
||||||
onEnterHandler = evt -> {
|
onEnterHandler = evt -> {
|
||||||
Button bt = (Button) evt.getSource();
|
Button bt = (Button) evt.getSource();
|
||||||
bt.setBackground(btNormalHover);
|
bt.setBackground(btNormalHover);
|
||||||
};
|
};
|
||||||
|
|
||||||
onExitHandler= evt -> {
|
onExitHandler = evt -> {
|
||||||
Button bt = (Button) evt.getSource();
|
Button bt = (Button) evt.getSource();
|
||||||
bt.setBackground(btNormalBackground);
|
bt.setBackground(btNormalBackground);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
if (obj instanceof Discipline) {
|
||||||
|
Discipline disciplineActuelle = (Discipline) obj;
|
||||||
|
nom = disciplineActuelle.getNom();
|
||||||
|
actionHandler = event -> {
|
||||||
|
Donnees.setDisciplineSelectionee(disciplineActuelle);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
Thematique thematiqueActuelle = (Thematique) obj;
|
||||||
|
nom = thematiqueActuelle.getNom();
|
||||||
|
actionHandler = event -> {
|
||||||
|
Donnees.setThematiqueSelectionee(thematiqueActuelle);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
onPressHandler = event -> {
|
onPressHandler = event -> {
|
||||||
Button bt = (Button) event.getSource();
|
Button bt = (Button) event.getSource();
|
||||||
if(bt.getBackground().equals(btNormalSelected)){
|
if (bt.getBackground().equals(btNormalSelected)) {
|
||||||
bt.setBackground(btNormalHover);
|
bt.setBackground(btNormalHover);
|
||||||
bt.setOnMouseEntered(onEnterHandler);
|
bt.setOnMouseEntered(onEnterHandler);
|
||||||
bt.setOnMouseExited(onExitHandler);
|
} else {
|
||||||
}
|
if (obj instanceof Discipline) {
|
||||||
else{
|
for (int i = 0; i < discipline.getChildren().size(); ++i) {
|
||||||
|
Button btChild = (Button) discipline.getChildren().get(i);
|
||||||
|
btChild.setBackground(btNormalBackground);
|
||||||
|
|
||||||
|
btChild.setOnMouseEntered(onEnterHandler);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < thematique.getChildren().size(); ++i) {
|
||||||
|
Button btChild = (Button) thematique.getChildren().get(i);
|
||||||
|
btChild.setBackground(btNormalBackground);
|
||||||
|
btChild.setOnMouseEntered(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
bt.setBackground(btNormalSelected);
|
bt.setBackground(btNormalSelected);
|
||||||
bt.setOnMouseEntered(null);
|
bt.setOnMouseEntered(null);
|
||||||
bt.setOnMouseExited(null);
|
bt.setOnMouseExited(null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( obj instanceof Discipline ){
|
|
||||||
Discipline disciplineActuelle = (Discipline) obj;
|
|
||||||
nom = disciplineActuelle.getNom();
|
|
||||||
actionHandler = event -> {Donnees.setDisciplineSelectionee(disciplineActuelle);};
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Thematique thematiqueActuelle = (Thematique) obj;
|
|
||||||
nom = thematiqueActuelle.getNom();
|
|
||||||
actionHandler = event -> {Donnees.setThematiqueSelectionee(thematiqueActuelle);};
|
|
||||||
}
|
|
||||||
|
|
||||||
Button bt = new Button(nom);
|
Button bt = new Button(nom);
|
||||||
bt.setMnemonicParsing(false);
|
bt.setMnemonicParsing(false);
|
||||||
bt.setMinSize(235,115);
|
bt.setMinSize(235, 115);
|
||||||
bt.layoutXProperty().setValue(x);
|
bt.layoutXProperty().setValue(x);
|
||||||
bt.layoutYProperty().setValue(y);
|
bt.layoutYProperty().setValue(y);
|
||||||
bt.setId(nom);
|
bt.setId(nom);
|
||||||
@ -128,30 +147,28 @@ public class Controller implements Initializable {
|
|||||||
return bt;
|
return bt;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Void placeButtonDiscipline(){
|
private Void placeButtonDiscipline() {
|
||||||
List<Discipline> disciplines = daoDiscipline.findAll();
|
List<Discipline> disciplines = daoDiscipline.findAll();
|
||||||
discipline.setMinHeight(disciplines.size()*65);
|
discipline.setMinHeight(disciplines.size() * 65);
|
||||||
for (int i = 0;i<disciplines.size();++i){
|
for (int i = 0; i < disciplines.size(); ++i) {
|
||||||
if (i%2 == 0){
|
if (i % 2 == 0) {
|
||||||
discipline.getChildren().add(initButton(disciplines.get(i),38,i/2*130));
|
discipline.getChildren().add(initButton(disciplines.get(i), 38, i / 2 * 130));
|
||||||
}
|
} else {
|
||||||
else {
|
discipline.getChildren().add(initButton(disciplines.get(i), 332, i / 2 * 130));
|
||||||
discipline.getChildren().add(initButton(disciplines.get(i),332,i/2*130));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Void placeButtonThematique(){
|
private Void placeButtonThematique() {
|
||||||
List<Thematique> thematiques = daoThematique.findAll();
|
List<Thematique> thematiques = daoThematique.findAll();
|
||||||
thematique.setMinHeight(thematiques.size()*65);
|
thematique.setMinHeight(thematiques.size() * 65);
|
||||||
for (int i = 0;i<thematiques.size();++i){
|
for (int i = 0; i < thematiques.size(); ++i) {
|
||||||
if (i%2 == 0){
|
if (i % 2 == 0) {
|
||||||
thematique.getChildren().add(initButton(thematiques.get(i),38,i/2*130));
|
thematique.getChildren().add(initButton(thematiques.get(i), 38, i / 2 * 130));
|
||||||
}
|
} else {
|
||||||
else {
|
thematique.getChildren().add(initButton(thematiques.get(i), 332, i / 2 * 130));
|
||||||
thematique.getChildren().add(initButton(thematiques.get(i),332,i/2*130));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -169,17 +186,17 @@ public class Controller implements Initializable {
|
|||||||
daoUsage = daoFactory.createDAOUsage();
|
daoUsage = daoFactory.createDAOUsage();
|
||||||
|
|
||||||
// a chaque fois
|
// a chaque fois
|
||||||
|
|
||||||
List<Discipline> d = daoDiscipline.findAll();
|
List<Discipline> d = daoDiscipline.findAll();
|
||||||
List<Thematique> t = daoThematique.findAll();
|
List<Thematique> t = daoThematique.findAll();
|
||||||
|
|
||||||
placeButtonThematique();
|
placeButtonThematique();
|
||||||
placeButtonDiscipline();
|
placeButtonDiscipline();
|
||||||
EventHandler<ActionEvent> handler = event ->{
|
EventHandler<ActionEvent> handler = event -> {
|
||||||
//TODO Recherche en fonctions des objets selectionnés
|
//TODO Recherche en fonctions des objets selectionnés
|
||||||
|
|
||||||
Donnees.setUsagesObtenus(daoUsage.findByCriterias(Donnees.getThematiqueSelectionee(),Donnees.getDisciplineSelectionee(),Donnees.getAcademieSelectionee()));
|
Donnees.setUsagesObtenus(daoUsage.findByCriterias(Donnees.getThematiqueSelectionee(), Donnees.getDisciplineSelectionee(), Donnees.getAcademieSelectionee()));
|
||||||
|
|
||||||
Stage resultats = new Stage();
|
Stage resultats = new Stage();
|
||||||
try {
|
try {
|
||||||
resultats.setScene(new Scene(FXMLLoader.load(getClass().getResource("/fr/univ_amu/iut/fResultat/FResultat.fxml"))));
|
resultats.setScene(new Scene(FXMLLoader.load(getClass().getResource("/fr/univ_amu/iut/fResultat/FResultat.fxml"))));
|
||||||
@ -187,7 +204,7 @@ public class Controller implements Initializable {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
recherche.setOnAction(handler);
|
recherche.setOnAction(handler);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- database connection properties -->
|
<!-- database connection properties -->
|
||||||
<property name="jakarta.persistence.jdbc.url" value="jdbc:mysql://localhost/devapp"/>
|
<property name="jakarta.persistence.jdbc.url" value="jdbc:mysql://lagrottedeneotaku.hopto.org:6776/devapp"/>
|
||||||
<property name="jakarta.persistence.jdbc.user" value="devapp"/>
|
<property name="jakarta.persistence.jdbc.user" value="devapp"/>
|
||||||
<property name="jakarta.persistence.jdbc.password" value="7kPoWBgoV5ahygxyXYGzaL"/>
|
<property name="jakarta.persistence.jdbc.password" value="7kPoWBgoV5ahygxyXYGzaL"/>
|
||||||
<!-- Nous ne devrions pas commit le mot de passe dans le dépot, mais... je ne pense pas que le projet ne respecte la moindre règle de sécurité de toute facon (pas d'architecture trois tiers)-->
|
<!-- Nous ne devrions pas commit le mot de passe dans le dépot, mais... je ne pense pas que le projet ne respecte la moindre règle de sécurité de toute facon (pas d'architecture trois tiers)-->
|
||||||
|
Loading…
Reference in New Issue
Block a user