JavaFXAddContentPresentationDelegate.java

  1. /*
  2.  * #%L
  3.  * *********************************************************************************************************************
  4.  *
  5.  * NorthernWind - lightweight CMS
  6.  * http://northernwind.tidalwave.it - git clone git@bitbucket.org:tidalwave/northernwind-rca-src.git
  7.  * %%
  8.  * Copyright (C) 2013 - 2021 Tidalwave s.a.s. (http://tidalwave.it)
  9.  * %%
  10.  * *********************************************************************************************************************
  11.  *
  12.  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  13.  * the License. You may obtain a copy of the License at
  14.  *
  15.  *     http://www.apache.org/licenses/LICENSE-2.0
  16.  *
  17.  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  18.  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
  19.  * specific language governing permissions and limitations under the License.
  20.  *
  21.  * *********************************************************************************************************************
  22.  *
  23.  *
  24.  * *********************************************************************************************************************
  25.  * #L%
  26.  */
  27. package it.tidalwave.northernwind.rca.ui.impl.javafx.contentmanager;

  28. import javax.annotation.Nonnull;
  29. import javafx.fxml.FXML;
  30. import javafx.scene.layout.Pane;
  31. import javafx.scene.control.TextField;
  32. import it.tidalwave.util.ui.UserNotificationWithFeedback;
  33. import it.tidalwave.role.ui.javafx.JavaFXBinder;
  34. import it.tidalwave.northernwind.rca.ui.contentmanager.AddContentPresentation;
  35. import lombok.RequiredArgsConstructor;

  36. /***********************************************************************************************************************
  37.  *
  38.  * @author  Fabrizio Giudici
  39.  *
  40.  **********************************************************************************************************************/
  41. @RequiredArgsConstructor
  42. public class JavaFXAddContentPresentationDelegate implements AddContentPresentation
  43.   {
  44.     @Nonnull
  45.     private final JavaFXBinder binder;

  46.     @FXML
  47.     private Pane pnPane;

  48.     @FXML
  49.     private TextField tfFolder;

  50.     @FXML
  51.     private TextField tfTitle;

  52.     @FXML
  53.     private TextField tfTags;

  54.     @FXML
  55.     private TextField tfExposedUri;

  56.     @FXML
  57.     private TextField tfPublishingDateTime;

  58.     private Bindings bindings;

  59.     @Override
  60.     public void bind (final @Nonnull Bindings bindings)
  61.       {
  62.         binder.bindBidirectionally(tfFolder, bindings.folder, bindings.folderValid);
  63.         binder.bindBidirectionally(tfTitle, bindings.title, bindings.titleValid);
  64.         binder.bindBidirectionally(tfExposedUri, bindings.exposedUri, bindings.exposedUriValid);
  65.         binder.bindBidirectionally(tfTags, bindings.tags, bindings.tagsValid);
  66.         // FIXME after NWRCA-95
  67.         // would be better binder.bind(tfPublishingDateTim, pm) with a pm with a Displayable and a Mutable.
  68.         // binder.bindBidirectionally(tfPublishingDateTime, bindings.publishingDateTime,
  69.         //                                                  bindings.publishingDateTimeValid);
  70.         this.bindings = bindings;
  71.       }

  72.     @Override
  73.     public void showUp (final @Nonnull UserNotificationWithFeedback notification)
  74.       {
  75.         binder.showInModalDialog(pnPane, notification, bindings.valid);
  76.       }
  77.   }