Skip to content

Package: JavaFXContentEditorPresentationDelegate

JavaFXContentEditorPresentationDelegate

nameinstructionbranchcomplexitylinemethod
JavaFXContentEditorPresentationDelegate(JavaFXBinder)
M: 16 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
bind(ContentEditorPresentation.Bindings)
M: 23 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
clear()
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
initialize()
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
lambda$new$0(WebEvent)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
populateDocument(String)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
populateProperties(PresentationModel)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
showUp()
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

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.contenteditor;
28:
29: import javax.annotation.Nonnull;
30: import javafx.collections.FXCollections;
31: import javafx.fxml.FXML;
32: import javafx.event.EventHandler;
33: import javafx.scene.control.Button;
34: import javafx.scene.control.TableView;
35: import javafx.scene.control.TextField;
36: import javafx.scene.web.WebEvent;
37: import javafx.scene.web.WebView;
38: import javafx.scene.layout.Pane;
39: import it.tidalwave.role.ui.PresentationModel;
40: import it.tidalwave.role.ui.javafx.JavaFXBinder;
41: import it.tidalwave.northernwind.rca.ui.contenteditor.ContentEditorPresentation;
42: import lombok.RequiredArgsConstructor;
43: import lombok.extern.slf4j.Slf4j;
44:
45: /***********************************************************************************************************************
46: *
47: * @author Fabrizio Giudici
48: *
49: **********************************************************************************************************************/
50:•@RequiredArgsConstructor @Slf4j
51: public class JavaFXContentEditorPresentationDelegate implements ContentEditorPresentation
52: {
53: @Nonnull
54: private final JavaFXBinder binder;
55:
56: @FXML
57: private Pane contentEditor;
58:
59: @FXML
60: private WebView contentWebView;
61:
62: @FXML
63: private TableView<PresentationModel> contentEditorProperties;
64:
65: @FXML
66: private TextField contentTitle;
67:
68: @FXML
69: private Button btOpenExternalEditor;
70:
71: @FXML
72: private Button btOpenExternalEditorBrowser;
73:
74: private final EventHandler<WebEvent<String>> clickHijacker = event -> log.debug("hijacked click: {}", event);
75:
76: public void initialize()
77: {
78: contentWebView.getEngine().setOnAlert(clickHijacker);
79: }
80:
81: @Override
82: public void bind (@Nonnull final Bindings bindings)
83: {
84: binder.bindBidirectionally(contentTitle.textProperty(), bindings.title);
85: binder.bind(btOpenExternalEditor, bindings.openExternalEditorAction);
86: binder.bind(btOpenExternalEditorBrowser, bindings.openExternalEditorBrowserAction);
87: }
88:
89: @Override
90: public void showUp()
91: {
92: // never used
93: }
94:
95: @Override
96: public void clear()
97: {
98: contentWebView.getEngine().loadContent("");
99: // FIXME: binder.unbind(contentEditorProperties)
100: contentEditorProperties.setItems(FXCollections.emptyObservableList());
101: }
102:
103: @Override
104: public void populateDocument (@Nonnull final String url)
105: {
106: contentWebView.getEngine().load(url);
107: }
108:
109: @Override
110: public void populateProperties (@Nonnull final PresentationModel pm)
111: {
112: binder.bind(contentEditorProperties, pm);
113: }
114: }