diff options
| author | polo <ordipolo@gmx.fr> | 2026-07-02 00:14:17 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2026-07-02 00:14:17 +0200 |
| commit | 0c2c3ee5a55f36d270171f2f67938542e251fdc5 (patch) | |
| tree | 8ea4d6a7ad09a5b1389b829980a7a5476982e754 /src/main/java/vue/AfficheTopMenu.java | |
| download | ppe_javafx-0c2c3ee5a55f36d270171f2f67938542e251fdc5.tar.gz ppe_javafx-0c2c3ee5a55f36d270171f2f67938542e251fdc5.tar.bz2 ppe_javafx-0c2c3ee5a55f36d270171f2f67938542e251fdc5.zip | |
fork utilisant maven
Diffstat (limited to 'src/main/java/vue/AfficheTopMenu.java')
| -rw-r--r-- | src/main/java/vue/AfficheTopMenu.java | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/src/main/java/vue/AfficheTopMenu.java b/src/main/java/vue/AfficheTopMenu.java new file mode 100644 index 0000000..f0449aa --- /dev/null +++ b/src/main/java/vue/AfficheTopMenu.java | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | package vue; | ||
| 2 | |||
| 3 | import controlleur.ControllerTopMenu; | ||
| 4 | import javafx.scene.control.Button; | ||
| 5 | import javafx.scene.control.Label; | ||
| 6 | import javafx.scene.image.Image; | ||
| 7 | import javafx.scene.image.ImageView; | ||
| 8 | import javafx.scene.layout.HBox; | ||
| 9 | import javafx.scene.layout.Pane; | ||
| 10 | import javafx.scene.layout.Priority; | ||
| 11 | import javafx.scene.paint.Color; | ||
| 12 | import javafx.stage.Stage; | ||
| 13 | import modele.Evenement; | ||
| 14 | import modele.User; | ||
| 15 | |||
| 16 | public class AfficheTopMenu extends HBox | ||
| 17 | { | ||
| 18 | private Label pseudo; | ||
| 19 | |||
| 20 | public AfficheTopMenu(Stage primaryStage, User session) | ||
| 21 | { | ||
| 22 | this.setStyle("-fx-background-color: gray; -fx-padding: 5px;"); | ||
| 23 | //-fx-spacing: 10px; | ||
| 24 | //Label title = new Label("Simulation"); // moche, à améliorer ou retirer | ||
| 25 | Button btn_account = new Button("Mon compte"); | ||
| 26 | Button btn_logout = new Button(); | ||
| 27 | Button btn_home = new Button("Accueil"); | ||
| 28 | Button btn_gerer_liste = new Button("Gerer liste"); | ||
| 29 | Button btn_creer_liste = new Button("Création liste"); | ||
| 30 | Button btn_admin = new Button("Admin"); | ||
| 31 | Button btn_simu = new Button("Simulation"); | ||
| 32 | |||
| 33 | |||
| 34 | HBox h1 = new HBox(); | ||
| 35 | h1.getChildren().addAll(btn_home, btn_account,btn_gerer_liste,btn_creer_liste,btn_simu); | ||
| 36 | |||
| 37 | |||
| 38 | |||
| 39 | Image icons_deco = new Image("/images/deco.png"); | ||
| 40 | ImageView icons_deco_box = new ImageView(icons_deco); | ||
| 41 | btn_logout.setGraphic(icons_deco_box); | ||
| 42 | icons_deco_box.setPreserveRatio(true); | ||
| 43 | icons_deco_box.fitHeightProperty().bind(btn_account.heightProperty()); | ||
| 44 | //this.getChildren().add(h1); | ||
| 45 | //this.setAlignment(javafx.geometry.Pos.CENTER_RIGHT); | ||
| 46 | //h1.setLeft(null); | ||
| 47 | //h2.setAlignment(javafx.geometry.Pos.TOP_RIGHT); | ||
| 48 | //this.setSpacing(getMaxWidth()); | ||
| 49 | //h1.setSpacing(10);// Ajoute un espace de 10 pixels entre les composants | ||
| 50 | //h2.setPadding(new Insets(1, 1, 20, 1)); | ||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | if(session.getRole().equals("Admin") ) { | ||
| 55 | h1.getChildren().add(btn_admin); | ||
| 56 | } | ||
| 57 | pseudo = new Label(session.getNom()); | ||
| 58 | //pseudo.setStyle("-fx-text-fill: white"); | ||
| 59 | pseudo.setTextFill(Color.WHITE); | ||
| 60 | pseudo.setStyle("-fx-font-weight: bold;"); | ||
| 61 | //barre.getChildren().addAll( pseudo, btn_logout); | ||
| 62 | |||
| 63 | |||
| 64 | //this.setAlignment(javafx.geometry.Pos.CENTER_RIGHT); | ||
| 65 | HBox h2 = new HBox(); | ||
| 66 | h2.getChildren().addAll( pseudo, btn_logout); | ||
| 67 | |||
| 68 | h1.setSpacing(10); | ||
| 69 | h2.setSpacing(10); | ||
| 70 | Pane p = new Pane(); | ||
| 71 | HBox.setHgrow(p, Priority.ALWAYS); | ||
| 72 | this.getChildren().addAll( h1,p, h2); | ||
| 73 | this.setAlignment(javafx.geometry.Pos.TOP_CENTER); | ||
| 74 | h1.setAlignment(javafx.geometry.Pos.CENTER_LEFT); | ||
| 75 | h2.setAlignment(javafx.geometry.Pos.CENTER_RIGHT); | ||
| 76 | |||
| 77 | |||
| 78 | // menu principal | ||
| 79 | btn_home.setOnAction(e -> { | ||
| 80 | ControllerTopMenu.go_accueil(primaryStage,session); | ||
| 81 | }); | ||
| 82 | // gestion de son compte | ||
| 83 | btn_account.setOnAction(e -> { | ||
| 84 | ControllerTopMenu.go_gestion_compte(primaryStage,session); | ||
| 85 | }); | ||
| 86 | // gestion des listes | ||
| 87 | btn_gerer_liste.setOnAction(e -> { | ||
| 88 | ControllerTopMenu.go_gestion_listes(primaryStage,session); | ||
| 89 | }); | ||
| 90 | // page de connexion | ||
| 91 | btn_logout.setOnAction(e -> { | ||
| 92 | ControllerTopMenu.go_deco(primaryStage, session); | ||
| 93 | }); | ||
| 94 | // simulation | ||
| 95 | btn_simu.setOnAction(e -> { | ||
| 96 | ControllerTopMenu.go_simulation(primaryStage,session); | ||
| 97 | }); | ||
| 98 | |||
| 99 | // options réservées à l'admin | ||
| 100 | btn_admin.setOnAction(e -> { | ||
| 101 | ControllerTopMenu.go_admin(primaryStage, session); | ||
| 102 | }); | ||
| 103 | |||
| 104 | //vers creer liste | ||
| 105 | btn_creer_liste.setOnAction(e->{ | ||
| 106 | ControllerTopMenu.go_creer_liste(primaryStage,session); | ||
| 107 | }); | ||
| 108 | |||
| 109 | } | ||
| 110 | |||
| 111 | public void setLogin(String login) | ||
| 112 | { | ||
| 113 | pseudo.setText(login); | ||
| 114 | } | ||
| 115 | |||
| 116 | } | ||
