Fenetre principale terminée
This commit is contained in:
parent
524b54e6da
commit
81d76d8393
@ -1,27 +1,42 @@
|
||||
package fr.univ_amu.iut.fp;
|
||||
|
||||
import fr.univ_amu.iut.dao.DAO;
|
||||
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.AnchorPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
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"))
|
||||
@ -38,29 +53,75 @@ public class Controller implements Initializable {
|
||||
.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#ff6e40;" text="Button" />
|
||||
|
||||
/*<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" />*/
|
||||
@FXML
|
||||
private AnchorPane matiere;
|
||||
|
||||
private Button initButton(){
|
||||
|
||||
}
|
||||
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);
|
||||
DAO<Thematique> theme = new DAO<Thematique>();
|
||||
try {
|
||||
theme.findAll();
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
DAO<Ressource> ressource = new DAO<Ressource>();
|
||||
try {
|
||||
theme.findAll();
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 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));
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.Cursor?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ScrollPane?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?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/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.univ_amu.iut.fp.Controller">
|
||||
<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">
|
||||
@ -21,9 +18,9 @@
|
||||
</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 prefHeight="471.0" prefWidth="347.0" style="-fx-background-color: #f5f0e1;">
|
||||
<ScrollPane hbarPolicy="NEVER" prefHeight="471.0" prefWidth="347.0" style="-fx-background-color: #f5f0e1;">
|
||||
<content>
|
||||
<AnchorPane id="matiere" minHeight="0.0" minWidth="0.0" prefHeight="442.0" prefWidth="620.0" style="-fx-background-color: #f5f0e1#f5f0e1;">
|
||||
<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>
|
||||
@ -33,9 +30,9 @@
|
||||
</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 prefHeight="471.0" prefWidth="347.0" style="-fx-background-color: #f5f0e1;">
|
||||
<ScrollPane hbarPolicy="NEVER" prefHeight="471.0" prefWidth="347.0" style="-fx-background-color: #f5f0e1;">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="620.0" style="-fx-background-color: #f5f0e1#f5f0e1;">
|
||||
<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>
|
||||
|
@ -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