1 /*
2 * *************************************************************************************************************************************************************
3 *
4 * SteelBlue: DCI User Interfaces
5 * http://tidalwave.it/projects/steelblue
6 *
7 * Copyright (C) 2015 - 2025 by Tidalwave s.a.s. (http://tidalwave.it)
8 *
9 * *************************************************************************************************************************************************************
10 *
11 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
17 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
18 *
19 * *************************************************************************************************************************************************************
20 *
21 * git clone https://bitbucket.org/tidalwave/steelblue-src
22 * git clone https://github.com/tidalwave-it/steelblue-src
23 *
24 * *************************************************************************************************************************************************************
25 */
26 package it.tidalwave.ui.example.presentation.impl.javafx;
27
28 import jakarta.annotation.Nonnull;
29 import jakarta.inject.Inject;
30 import javafx.fxml.FXML;
31 import javafx.scene.control.MenuBar;
32 import javafx.scene.control.ToolBar;
33 import javafx.scene.layout.BorderPane;
34 import org.springframework.context.ApplicationContext;
35 import it.tidalwave.ui.javafx.JavaFXBinder;
36 import it.tidalwave.ui.javafx.PresentationAssembler;
37 import it.tidalwave.ui.javafx.JavaFXMenuBarControl;
38 import it.tidalwave.ui.javafx.JavaFXToolBarControl;
39
40 /***************************************************************************************************************************************************************
41 *
42 * This class is referred by Application.fxml and instantiated by the JavaFX runtime.
43 *
44 * @author Fabrizio Giudici
45 *
46 **************************************************************************************************************************************************************/
47 // START SNIPPET: all
48 public class JavaFXApplicationPresentationDelegate implements PresentationAssembler
49 {
50 @Inject
51 private JavaFXBinder binder;
52
53 @Inject
54 private JavaFXToolBarControl toolBarModel;
55
56 @Inject
57 private JavaFXMenuBarControl menuBarModel;
58
59 @FXML
60 private BorderPane pnMainPane;
61
62 @FXML
63 private ToolBar tbToolBar;
64
65 @FXML
66 private MenuBar mbMenuBar;
67
68 @Override
69 public void assemble (@Nonnull final ApplicationContext applicationContext)
70 {
71 toolBarModel.populate(binder, tbToolBar);
72 menuBarModel.populate(binder, mbMenuBar);
73 final var mainPanelPresentation = applicationContext.getBean(JavaFXMainPanelPresentation.class);
74 pnMainPane.setCenter(mainPanelPresentation.getNad().getNode());
75 }
76 }
77 // END SNIPPET: all