JavaFxHourlyReportPresentationDelegate.java

  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.hourlyreport.impl.javafx;

  27. import javax.annotation.Nonnull;
  28. import javafx.fxml.FXML;
  29. import javafx.scene.control.TextArea;
  30. import javafx.scene.layout.Pane;
  31. import it.tidalwave.accounting.ui.hourlyreport.HourlyReportPresentation;
  32. import it.tidalwave.util.ui.UserNotificationWithFeedback;
  33. import it.tidalwave.role.ui.PresentationModel;
  34. import it.tidalwave.role.ui.javafx.JavaFXBinder;
  35. import lombok.RequiredArgsConstructor;
  36. import static it.tidalwave.role.PlainTextRenderable._PlainTextRenderable_;

  37. /***************************************************************************************************************************************************************
  38.  *
  39.  * @author  fritz
  40.  *
  41.  **************************************************************************************************************************************************************/
  42. @RequiredArgsConstructor
  43. public class JavaFxHourlyReportPresentationDelegate implements HourlyReportPresentation
  44.   {
  45.     @Nonnull
  46.     private final JavaFXBinder binder;

  47.     @FXML
  48.     private Pane pnHourlyReport;

  49.     @FXML
  50.     private TextArea taReport;

  51.     @Override
  52.     public void bind()
  53.       {
  54.       }

  55.     @Override
  56.     public void showUp (@Nonnull final UserNotificationWithFeedback notification)
  57.       {
  58.         binder.showInModalDialog(pnHourlyReport, notification);
  59.       }

  60.     @Override
  61.     public void populate (@Nonnull final PresentationModel pm)
  62.       {
  63.         taReport.setText(pm.as(_PlainTextRenderable_).render());
  64.       }
  65.   }