avancé sur les buttons dynamique
This commit is contained in:
parent
6c5b569d36
commit
68a00597cc
44
src/main/java/fr/univ_amu/iut/DAORessourceTest.java
Normal file
44
src/main/java/fr/univ_amu/iut/DAORessourceTest.java
Normal file
@ -0,0 +1,44 @@
|
||||
package fr.univ_amu.iut;
|
||||
|
||||
import fr.univ_amu.iut.dao.DAORessource;
|
||||
import fr.univ_amu.iut.model.Ressource;
|
||||
import fr.univ_amu.iut.model.TypeRessource;
|
||||
|
||||
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() throws MalformedURLException {
|
||||
List<Ressource> liste = new ArrayList<>();
|
||||
for (int i = 0; i < 12; i++){
|
||||
TypeRessource type = new TypeRessource(String.valueOf(i));
|
||||
URL url = new URL("http://google.com");
|
||||
Ressource ressource = new Ressource(type,url);
|
||||
liste.add(ressource);
|
||||
}
|
||||
return liste;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ressource getById(int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ressource insert(Ressource obj) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(Ressource obj) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package fr.univ_amu.iut.dao;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.List;
|
||||
|
||||
public interface DAO<T> {
|
||||
@ -16,7 +17,7 @@ public interface DAO<T> {
|
||||
*
|
||||
* @return liste de tous les objets contenus dans la base
|
||||
*/
|
||||
List<T> findAll();
|
||||
List<T> findAll() throws MalformedURLException;
|
||||
|
||||
/**
|
||||
* Permet de récupérer un objet via son ID
|
||||
|
||||
@ -1,12 +1,18 @@
|
||||
package fr.univ_amu.iut.fp;
|
||||
|
||||
import fr.univ_amu.iut.dao.DAO;
|
||||
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.scene.control.Button;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
@ -32,9 +38,29 @@ 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="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(){
|
||||
|
||||
}
|
||||
@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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
<?import javafx.scene.Cursor?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ScrollBar?>
|
||||
<?import javafx.scene.control.ScrollPane?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
@ -13,36 +12,38 @@
|
||||
<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" promptText="Search" style="-fx-border-color: #ffc13b#ffc13b; -fx-background-color: #CDD0D4#CDD0D4; -fx-border-radius: 5em; -fx-background-radius: 5em;" text="Search" AnchorPane.leftAnchor="329.0" AnchorPane.rightAnchor="329.0">
|
||||
<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="740.0" layoutY="92.0" prefHeight="311.0" prefWidth="596.0" style="-fx-background-color: none;" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="92.0">
|
||||
<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;">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="308.0" prefWidth="642.0" style="-fx-background-color: #f5f0e1#f5f0e1;">
|
||||
<AnchorPane id="matiere" minHeight="0.0" minWidth="0.0" prefHeight="442.0" prefWidth="620.0" style="-fx-background-color: #f5f0e1#f5f0e1;">
|
||||
<children>
|
||||
<Button layoutX="38.0" layoutY="31.0" mnemonicParsing="false" prefHeight="115.0" prefWidth="235.0" style="-fx-background-radius: 30; -fx-background-color: #ff6e40#ff6e40;" text="Button" />
|
||||
<Button layoutX="332.0" layoutY="31.0" mnemonicParsing="false" prefHeight="115.0" prefWidth="235.0" style="-fx-background-radius: 30; -fx-background-color: #ff6e40#ff6e40;" text="Button" />
|
||||
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</children></StackPane>
|
||||
<StackPane layoutX="768.0" layoutY="440.0" prefHeight="344.0" prefWidth="599.0" style="-fx-background-color: none;" AnchorPane.rightAnchor="-2.0">
|
||||
<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="335.0" prefWidth="586.0" style="-fx-background-color: none;" />
|
||||
<AnchorPane prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: #f5f0e1#f5f0e1;">
|
||||
<children>
|
||||
<ScrollBar layoutX="579.0" nodeOrientation="LEFT_TO_RIGHT" orientation="VERTICAL" prefHeight="337.0" prefWidth="13.0" style="-fx-background-color: none;" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
<Button layoutX="38.0" layoutY="31.0" mnemonicParsing="false" prefHeight="115.0" prefWidth="235.0" style="-fx-background-radius: 30; -fx-background-color: #ff6e40#ff6e40;" text="Button" />
|
||||
<Button layoutX="332.0" layoutY="31.0" mnemonicParsing="false" prefHeight="115.0" prefWidth="235.0" style="-fx-background-radius: 30; -fx-background-color: #ff6e40#ff6e40;" text="Button" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children></StackPane>
|
||||
<ScrollPane 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;">
|
||||
<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>
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
package fr.univ_amu.iut.sp;
|
||||
|
||||
public class Controller {
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
package fr.univ_amu.iut.sp;
|
||||
|
||||
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/sp/sp.fxml"));
|
||||
stage.setScene(new Scene(root));
|
||||
stage.show();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.TableColumn?>
|
||||
<?import javafx.scene.control.TableView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
|
||||
|
||||
<AnchorPane prefHeight="400.0" prefWidth="600.0" style="-fx-background-color: blue;" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.univ_amu.iut.sp.Controller">
|
||||
<children>
|
||||
<TableView layoutX="28.0" layoutY="23.0" prefHeight="355.0" prefWidth="545.0" style="-fx-background-radius: 20;">
|
||||
<columns>
|
||||
|
||||
<TableColumn prefWidth="75.0" text="C1" />
|
||||
<TableColumn prefWidth="75.0" text="C2" />
|
||||
</columns>
|
||||
</TableView>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
Loading…
Reference in New Issue
Block a user