Merge pull request #4 from IUTInfoAix-R202-2022/fenetre_principale
Fenetre principale
This commit is contained in:
commit
f870b61118
@ -18,16 +18,16 @@ public class FranceMain extends Application {
|
||||
@Override
|
||||
public void init() {
|
||||
france = FranceBuilder.create()
|
||||
//.backgroundColor(Color.web("#4aa9d7"))
|
||||
//.fillColor(Color.web("#dcb36c"))
|
||||
//.strokeColor(Color.web("#987028"))
|
||||
//.hoverColor(Color.web("#fec47e"))
|
||||
//.pressedColor(Color.web("#6cee85"))
|
||||
//.selectedColor(Color.MAGENTA)
|
||||
.mousePressHandler(evt -> {
|
||||
AcademiePath academiePath = (AcademiePath) evt.getSource();
|
||||
System.out.println("On vient de cliquer sur l'"+academiePath.getAcademie().getNom());
|
||||
})
|
||||
// .backgroundColor(Color.web("#4aa9d7"))
|
||||
// .fillColor(Color.web("#dcb36c"))
|
||||
// .strokeColor(Color.web("#987028"))
|
||||
// .hoverColor(Color.web("#fec47e"))
|
||||
// .pressedColor(Color.web("#6cee85"))
|
||||
// .selectedColor(Color.MAGENTA)
|
||||
// .mousePressHandler(evt -> {
|
||||
// AcademiePath academiePath = (AcademiePath) evt.getSource();
|
||||
// System.out.println("On vient de cliquer sur l'"+academiePath.getAcademie().getNom());
|
||||
// })
|
||||
.selectionEnabled(true)
|
||||
.build();
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package fr.univ_amu.iut.dao;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.List;
|
||||
|
||||
public interface DAO<T> {
|
||||
|
@ -1,11 +1,13 @@
|
||||
package fr.univ_amu.iut.dao.factory;
|
||||
|
||||
import fr.univ_amu.iut.dao.jpa.DAOFactoryJPA;
|
||||
import fr.univ_amu.iut.test.DAOFactoryTest;
|
||||
|
||||
public class DAOFactoryProducer {
|
||||
public static DAOFactory getFactory(DAOType type) {
|
||||
return switch (type){
|
||||
case JPA -> new DAOFactoryJPA();
|
||||
case TEST -> new DAOFactoryTest();
|
||||
default -> throw new IllegalArgumentException();
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package fr.univ_amu.iut.dao.factory;
|
||||
|
||||
public enum DAOType {
|
||||
JPA
|
||||
JPA,
|
||||
TEST
|
||||
}
|
||||
|
127
src/main/java/fr/univ_amu/iut/fp/Controller.java
Normal file
127
src/main/java/fr/univ_amu/iut/fp/Controller.java
Normal file
@ -0,0 +1,127 @@
|
||||
package fr.univ_amu.iut.fp;
|
||||
|
||||
import fr.univ_amu.iut.dao.DAORessource;
|
||||
import fr.univ_amu.iut.dao.DAOThematique;
|
||||
import fr.univ_amu.iut.dao.factory.DAOFactory;
|
||||
import fr.univ_amu.iut.dao.factory.DAOFactoryProducer;
|
||||
import fr.univ_amu.iut.dao.factory.DAOType;
|
||||
import fr.univ_amu.iut.model.Ressource;
|
||||
import fr.univ_amu.iut.model.Thematique;
|
||||
import fr.univ_amu.iut.view.map.France;
|
||||
import fr.univ_amu.iut.view.map.FranceBuilder;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class Controller implements Initializable {
|
||||
France france;
|
||||
|
||||
|
||||
DAOFactory daoFactory;
|
||||
DAORessource daoRessource;
|
||||
DAOThematique daoThematique;
|
||||
|
||||
@FXML
|
||||
private Pane stackPaneFrance;
|
||||
|
||||
@FXML
|
||||
private AnchorPane ressource;
|
||||
|
||||
@FXML
|
||||
private AnchorPane thematique;
|
||||
|
||||
private void initFrance() {
|
||||
france = FranceBuilder.create()
|
||||
.backgroundColor(Color.web("#f5f0e1"))
|
||||
.fillColor(Color.web("#1e3d59"))
|
||||
// .strokeColor(Color.web("#987028"))
|
||||
// .hoverColor(Color.web("#fec47e"))
|
||||
// .pressedColor(Color.web("#6cee85"))
|
||||
// .selectedColor(Color.MAGENTA)
|
||||
// .mousePressHandler(evt -> {
|
||||
// AcademiePath academiePath = (AcademiePath) evt.getSource();
|
||||
// System.out.println("On vient de cliquer sur l'"+academiePath.getAcademie().getNom());
|
||||
// })
|
||||
.selectionEnabled(true)
|
||||
.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(String ressource,int x,int y){
|
||||
Button bt = new Button(ressource);
|
||||
bt.setMnemonicParsing(false);
|
||||
bt.setMinSize(235,115);
|
||||
bt.layoutXProperty().setValue(x);
|
||||
bt.layoutYProperty().setValue(y);
|
||||
bt.setId(ressource);
|
||||
bt.prefHeight(115);
|
||||
bt.prefWidth(235);
|
||||
bt.setText(ressource);
|
||||
bt.setBackground(new Background(new BackgroundFill(Color.rgb(255,110,64), new CornerRadii(30), Insets.EMPTY)));
|
||||
return bt;
|
||||
}
|
||||
|
||||
private Void placeButtonRessource(){
|
||||
List<Ressource> ressources = daoRessource.findAll();
|
||||
ressource.setMinHeight(ressources.size()*65);
|
||||
for (int i = 0;i<ressources.size();++i){
|
||||
if (i%2 == 0){
|
||||
ressource.getChildren().add(initButton(ressources.get(i).getNomRessource(),38,i/2*130));
|
||||
}
|
||||
else {
|
||||
ressource.getChildren().add(initButton(ressources.get(i).getNomRessource(),332,i/2*130));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Void placeButtonThematique(){
|
||||
List<Thematique> thematiques = daoThematique.findAll();
|
||||
thematique.setMinHeight(thematiques.size()*65);
|
||||
for (int i = 0;i<thematiques.size();++i){
|
||||
if (i%2 == 0){
|
||||
thematique.getChildren().add(initButton(thematiques.get(i).getNom(),38,i/2*130));
|
||||
}
|
||||
else {
|
||||
thematique.getChildren().add(initButton(thematiques.get(i).getNom(),332,i/2*130));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
initFrance();
|
||||
stackPaneFrance.getChildren().add(france);
|
||||
|
||||
// init
|
||||
daoFactory = DAOFactoryProducer.getFactory(DAOType.TEST);
|
||||
daoRessource = daoFactory.createDAORessource();
|
||||
daoThematique = daoFactory.createDAOThematique();
|
||||
|
||||
// a chaque fois
|
||||
List<Ressource> l = daoRessource.findAll();
|
||||
List<Thematique> t = daoThematique.findAll();
|
||||
|
||||
System.out.println(l);
|
||||
|
||||
|
||||
placeButtonThematique();
|
||||
placeButtonRessource();
|
||||
// matiere.getChildren().add(initButton(t.get(0).getNom(),38,30));
|
||||
// matiere.getChildren().add(initButton("test",38,160));
|
||||
}
|
||||
}
|
25
src/main/java/fr/univ_amu/iut/fp/Main.java
Normal file
25
src/main/java/fr/univ_amu/iut/fp/Main.java
Normal file
@ -0,0 +1,25 @@
|
||||
package fr.univ_amu.iut.fp;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
|
||||
|
||||
public class Main extends Application {
|
||||
|
||||
public static void main(String[] args) {launch(args);}
|
||||
@Override
|
||||
public void start(Stage stage) throws Exception {
|
||||
try {
|
||||
AnchorPane root = FXMLLoader.load(getClass().getResource("/fr/univ_amu/iut/fp/fp.fxml"));
|
||||
stage.setScene(new Scene(root));
|
||||
stage.show();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
46
src/main/java/fr/univ_amu/iut/fp/fp.fxml
Normal file
46
src/main/java/fr/univ_amu/iut/fp/fp.fxml
Normal file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<AnchorPane id="root" prefHeight="798.0" prefWidth="1365.0" style="-fx-background-color: #f5f0e1#f5f0e1;" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.univ_amu.iut.fp.Controller">
|
||||
<children>
|
||||
<StackPane id="stackPaneFrance" fx:id="stackPaneFrance" layoutX="43.0" layoutY="92.0" prefHeight="649.0" prefWidth="642.0" style="-fx-background-color: blue;" />
|
||||
<AnchorPane layoutX="11.0" prefHeight="80.0" prefWidth="1019.0" style="-fx-background-color: #1e3d59#1e3d59;" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
||||
<children>
|
||||
<TextField id="barreDeRecherche " layoutX="329.0" layoutY="27.0" prefHeight="27.0" prefWidth="372.0" style="-fx-background-color: #CDD0D4#CDD0D4; -fx-border-radius: 5em; -fx-background-radius: 5em;" text="Entrer nom projet : " AnchorPane.leftAnchor="329.0" AnchorPane.rightAnchor="329.0">
|
||||
<cursor>
|
||||
<Cursor fx:constant="CROSSHAIR" />
|
||||
</cursor>
|
||||
</TextField>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<StackPane layoutX="744.0" layoutY="100.0" prefHeight="181.0" prefWidth="622.0" style="-fx-background-color: none;" AnchorPane.rightAnchor="-1.0" AnchorPane.topAnchor="100.0">
|
||||
<children>
|
||||
<ScrollPane hbarPolicy="NEVER" prefHeight="471.0" prefWidth="347.0" style="-fx-background-color: #f5f0e1;">
|
||||
<content>
|
||||
<AnchorPane id="ressource" fx:id="ressource" minHeight="0.0" minWidth="0.0" prefHeight="442.0" prefWidth="620.0" style="-fx-background-color: #f5f0e1#f5f0e1;">
|
||||
<children>
|
||||
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</children></StackPane>
|
||||
<StackPane layoutX="771.0" layoutY="370.0" prefHeight="181.0" prefWidth="622.0" style="-fx-background-color: none;" AnchorPane.rightAnchor="0.0">
|
||||
<children>
|
||||
<ScrollPane hbarPolicy="NEVER" prefHeight="471.0" prefWidth="347.0" style="-fx-background-color: #f5f0e1;">
|
||||
<content>
|
||||
<AnchorPane id="thematique" fx:id="thematique" minHeight="0.0" minWidth="0.0" prefHeight="699.0" prefWidth="620.0" style="-fx-background-color: #f5f0e1#f5f0e1;">
|
||||
<children>
|
||||
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</children>
|
||||
</StackPane>
|
||||
<Button layoutX="875.0" layoutY="606.0" mnemonicParsing="false" prefHeight="120.0" prefWidth="337.0" style="-fx-background-radius: 50; -fx-background-color: #ffc13b#ffc13b;" text="RECHERCHER" AnchorPane.bottomAnchor="72.0" AnchorPane.rightAnchor="153.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
@ -13,14 +13,11 @@ public class Ressource {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
int id;
|
||||
|
||||
String nomRessource;
|
||||
|
||||
@ManyToOne
|
||||
TypeRessource typeRessource;
|
||||
String typeRessource;
|
||||
URL lienRessource;
|
||||
|
||||
public Ressource(TypeRessource typeRessource, URL lienRessource) {
|
||||
public Ressource(String typeRessource, URL lienRessource) {
|
||||
this.typeRessource = typeRessource;
|
||||
this.lienRessource = lienRessource;
|
||||
}
|
||||
@ -29,7 +26,7 @@ public class Ressource {
|
||||
|
||||
}
|
||||
|
||||
public TypeRessource getTypeRessource() {
|
||||
public String getTypeRessource() {
|
||||
return typeRessource;
|
||||
}
|
||||
|
||||
|
37
src/main/java/fr/univ_amu/iut/test/DAOAcademieTest.java
Normal file
37
src/main/java/fr/univ_amu/iut/test/DAOAcademieTest.java
Normal file
@ -0,0 +1,37 @@
|
||||
package fr.univ_amu.iut.test;
|
||||
|
||||
import fr.univ_amu.iut.dao.DAOAcademie;
|
||||
import fr.univ_amu.iut.model.Academie;
|
||||
import java.util.List;
|
||||
|
||||
public class DAOAcademieTest implements DAOAcademie {
|
||||
@Override
|
||||
public boolean delete(Academie obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Academie> findAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Academie getById(int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insert(Academie obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(Academie obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Academie getByCode(String code) {
|
||||
return null;
|
||||
}
|
||||
}
|
32
src/main/java/fr/univ_amu/iut/test/DAODisciplineTest.java
Normal file
32
src/main/java/fr/univ_amu/iut/test/DAODisciplineTest.java
Normal file
@ -0,0 +1,32 @@
|
||||
package fr.univ_amu.iut.test;
|
||||
|
||||
import fr.univ_amu.iut.dao.DAODiscipline;
|
||||
import fr.univ_amu.iut.model.Discipline;
|
||||
import java.util.List;
|
||||
|
||||
public class DAODisciplineTest implements DAODiscipline {
|
||||
@Override
|
||||
public boolean delete(Discipline obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Discipline> findAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Discipline getById(int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insert(Discipline obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(Discipline obj) {
|
||||
return false;
|
||||
}
|
||||
}
|
42
src/main/java/fr/univ_amu/iut/test/DAOFactoryTest.java
Normal file
42
src/main/java/fr/univ_amu/iut/test/DAOFactoryTest.java
Normal file
@ -0,0 +1,42 @@
|
||||
package fr.univ_amu.iut.test;
|
||||
|
||||
import fr.univ_amu.iut.dao.*;
|
||||
import fr.univ_amu.iut.dao.factory.DAOFactory;
|
||||
|
||||
public class DAOFactoryTest implements DAOFactory {
|
||||
|
||||
@Override
|
||||
public DAOAcademie createDAOAcademie() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAOActeur createDAOActeur() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAODiscipline createDAODiscipline() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAORegionAcademique createDAORegionAcademique() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAORessource createDAORessource() {
|
||||
return new DAORessourceTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAOThematique createDAOThematique() {
|
||||
return new DAOThematiqueTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAOUsage createDAOUsage() {
|
||||
return null;
|
||||
}
|
||||
}
|
47
src/main/java/fr/univ_amu/iut/test/DAORessourceTest.java
Normal file
47
src/main/java/fr/univ_amu/iut/test/DAORessourceTest.java
Normal file
@ -0,0 +1,47 @@
|
||||
package fr.univ_amu.iut.test;
|
||||
|
||||
import fr.univ_amu.iut.dao.DAORessource;
|
||||
import fr.univ_amu.iut.model.Ressource;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DAORessourceTest implements DAORessource {
|
||||
@Override
|
||||
public boolean delete(Ressource obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Ressource> findAll() {
|
||||
List<Ressource> liste = new ArrayList<>();
|
||||
for (int i = 0; i < 12; i++){
|
||||
URL url = null;
|
||||
try {
|
||||
url = new URL("http://google.com");
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Ressource ressource = new Ressource("bah google lol", url);
|
||||
liste.add(ressource);
|
||||
}
|
||||
return liste;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ressource getById(int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insert(Ressource obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(Ressource obj) {
|
||||
return false;
|
||||
}
|
||||
}
|
47
src/main/java/fr/univ_amu/iut/test/DAOThematiqueTest.java
Normal file
47
src/main/java/fr/univ_amu/iut/test/DAOThematiqueTest.java
Normal file
@ -0,0 +1,47 @@
|
||||
package fr.univ_amu.iut.test;
|
||||
|
||||
import fr.univ_amu.iut.dao.DAOThematique;
|
||||
import fr.univ_amu.iut.model.Thematique;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DAOThematiqueTest implements DAOThematique {
|
||||
@Override
|
||||
public boolean delete(Thematique obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Thematique> findAll() {
|
||||
List<Thematique> liste = new ArrayList<>();
|
||||
for (int i = 0; i < 12; i++){
|
||||
URL url = null;
|
||||
try {
|
||||
url = new URL("http://google.com");
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Thematique thematique = new Thematique(String.valueOf(i));
|
||||
liste.add(thematique);
|
||||
}
|
||||
return liste;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thematique getById(int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insert(Thematique obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(Thematique obj) {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -14,4 +14,5 @@ open module francefx {
|
||||
exports fr.univ_amu.iut;
|
||||
exports fr.univ_amu.iut.dao;
|
||||
exports fr.univ_amu.iut.dao.factory;
|
||||
exports fr.univ_amu.iut.test;
|
||||
}
|
Loading…
Reference in New Issue
Block a user