View Javadoc
1   /*
2    * *************************************************************************************************************************************************************
3    *
4    * blueHour: open source accounting
5    * http://tidalwave.it/projects/bluehour
6    *
7    * Copyright (C) 2013 - 2024 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/bluehour-src
22   * git clone https://github.com/tidalwave-it/bluehour-src
23   *
24   * *************************************************************************************************************************************************************
25   */
26  package it.tidalwave.accounting.ui.impl.javafx;
27  
28  import javax.annotation.Nonnull;
29  import javafx.fxml.FXML;
30  import javafx.scene.Node;
31  import javafx.scene.control.ToolBar;
32  import javafx.scene.layout.AnchorPane;
33  import it.tidalwave.role.ui.ToolBarModel;
34  import it.tidalwave.role.ui.javafx.JavaFXBinder;
35  import lombok.Getter;
36  import lombok.RequiredArgsConstructor;
37  import lombok.extern.slf4j.Slf4j;
38  
39  /***************************************************************************************************************************************************************
40   *
41   * @author Fabrizio Giudici
42   *
43   **************************************************************************************************************************************************************/
44  @RequiredArgsConstructor @Slf4j @Getter
45  public class JavaFXApplicationPresentationDelegate
46    {
47      @Nonnull
48      private final JavaFXBinder binder;
49  
50      @FXML
51      private ToolBar tbToolBar;
52  
53      @FXML
54      private AnchorPane pnCustomerExplorer;
55  
56      @FXML
57      private AnchorPane pnProjectExplorer;
58  
59      @FXML
60      private AnchorPane pnJobEventExplorer;
61  
62      public void assemble (@Nonnull final ToolBarModel toolBarModel,
63                            @Nonnull final Node ndCustomerExplorer,
64                            @Nonnull final Node ndProjectExplorer,
65                            @Nonnull final Node ndJobEventExplorer)
66        {
67          toolBarModel.populate(binder, tbToolBar);
68          put(pnCustomerExplorer, ndCustomerExplorer);
69          put(pnProjectExplorer, ndProjectExplorer);
70          put(pnJobEventExplorer, ndJobEventExplorer);
71        }
72  
73      private static void put (@Nonnull final AnchorPane anchorPane, @Nonnull final Node node)
74        {
75          AnchorPane.setLeftAnchor(node, 0.0);
76          AnchorPane.setRightAnchor(node, 0.0);
77          AnchorPane.setTopAnchor(node, 0.0);
78          AnchorPane.setBottomAnchor(node, 0.0);
79          anchorPane.getChildren().add(node);
80        }
81    }