Package: JavaFXApplicationPresentationDelegate
JavaFXApplicationPresentationDelegate
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
assemble(ApplicationContext) |
|
|
|
|
|
||||||||||||||||||||
assemble(JavaFXToolBarControl, JavaFXMenuBarControl, JavaFXPanelGroupControl) |
|
|
|
|
|
||||||||||||||||||||
notify(UserNotification) |
|
|
|
|
|
||||||||||||||||||||
static {...} |
|
|
|
|
|
Coverage
1: /*
2: * *************************************************************************************************************************************************************
3: *
4: * blueMarine III: Semantic DAM
5: * http://tidalwave.it/projects/bluemarine3
6: *
7: * Copyright (C) 2024 - 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/bluemarine3-src
22: * git clone https://github.com/tidalwave-it/bluemarine3-src
23: *
24: * *************************************************************************************************************************************************************
25: */
26: package it.tidalwave.bluemarine3.ui.impl.javafx;
27:
28: import jakarta.annotation.Nonnull;
29: import javafx.fxml.FXML;
30: import javafx.scene.control.MenuBar;
31: import javafx.scene.control.ToolBar;
32: import javafx.scene.layout.AnchorPane;
33: import org.springframework.context.ApplicationContext;
34: import it.tidalwave.bluemarine3.ui.ApplicationPresentation;
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.JavaFXPanelGroupControl;
39: import it.tidalwave.ui.javafx.JavaFXToolBarControl;
40: import it.tidalwave.util.ui.UserNotification;
41: import lombok.Getter;
42: import lombok.RequiredArgsConstructor;
43: import lombok.extern.slf4j.Slf4j;
44: import static it.tidalwave.ui.core.PanelGroupControl.Options.*;
45: import static it.tidalwave.ui.core.PanelGroupProvider.Selector.*;
46:
47: /***************************************************************************************************************************************************************
48: *
49: * @stereotype Presentation
50: * @author Fabrizio Giudici
51: *
52: **************************************************************************************************************************************************************/
53: @RequiredArgsConstructor @Slf4j @Getter
54: public class JavaFXApplicationPresentationDelegate implements ApplicationPresentation, PresentationAssembler
55: {
56: @FXML
57: private MenuBar mbMenuBar;
58:
59: @FXML
60: private ToolBar tbToolBar;
61:
62: @FXML
63: private AnchorPane pnLeft;
64:
65: @FXML
66: private AnchorPane pnCenter;
67:
68: @FXML
69: private AnchorPane pnBottom;
70:
71: @Nonnull
72: private final JavaFXBinder binder;
73:
74: /***********************************************************************************************************************************************************
75: * {@inheritDoc}
76: **********************************************************************************************************************************************************/
77: @Override
78: public void notify (@Nonnull final UserNotification notification)
79: {
80: binder.showInModalDialog(notification);
81: }
82:
83: /***********************************************************************************************************************************************************
84: * {@inheritDoc}
85: **********************************************************************************************************************************************************/
86: @Override
87: public void assemble (@Nonnull final ApplicationContext applicationContext) // FIXME: drop, use annotations for injection of parameters
88: {
89: final var toolBarControl = applicationContext.getBean(JavaFXToolBarControl.class);
90: final var menuBarControl = applicationContext.getBean(JavaFXMenuBarControl.class);
91: final var panelControl = applicationContext.getBean(JavaFXPanelGroupControl.class);
92: assemble(toolBarControl, menuBarControl, panelControl);
93: }
94:
95: /***********************************************************************************************************************************************************
96: * @param toolBarControl
97: * @param menuBarControl
98: * @param panelGroupControl
99: **********************************************************************************************************************************************************/
100: private void assemble (@Nonnull final JavaFXToolBarControl toolBarControl,
101: @Nonnull final JavaFXMenuBarControl menuBarControl,
102: @Nonnull final JavaFXPanelGroupControl panelGroupControl)
103: {
104: toolBarControl.populate(binder, tbToolBar);
105: menuBarControl.populate(binder, mbMenuBar);
106: panelGroupControl.setup(panelGroupControl.config()
107: .withGroup(LEFT, pnLeft)
108: .withGroup(CENTER, pnCenter /*, USE_STACKPANE */) // FIXME: doesn't work
109: .withGroup(BOTTOM, pnBottom)
110: .withOptions(ALWAYS_USE_WRAPPER, DISABLE_ACCORDION_ANIMATION));
111: }
112: }