|
8 | 8 | import javafx.collections.ListChangeListener; |
9 | 9 | import javafx.concurrent.WorkerStateEvent; |
10 | 10 | import javafx.event.ActionEvent; |
| 11 | +import javafx.event.EventHandler; |
11 | 12 | import javafx.fxml.Initializable; |
12 | 13 | import javafx.scene.Scene; |
13 | 14 | import javafx.scene.control.*; |
14 | 15 | import javafx.scene.image.Image; |
15 | 16 | import javafx.scene.image.ImageView; |
| 17 | +import javafx.scene.input.KeyEvent; |
16 | 18 | import javafx.scene.layout.BorderPane; |
| 19 | +import javafx.scene.layout.HBox; |
17 | 20 | import javafx.scene.layout.VBox; |
18 | 21 | import javafx.stage.Stage; |
19 | 22 | import lombok.RequiredArgsConstructor; |
@@ -53,6 +56,10 @@ public class KodiToolsController implements Initializable { |
53 | 56 |
|
54 | 57 | public CheckBox checkBoxHideEmpty; |
55 | 58 |
|
| 59 | + public HBox goCancelButtonsComponent; |
| 60 | + |
| 61 | + public CheckBox checkBoxMissingNfoFileIsAWarning; |
| 62 | + |
56 | 63 | private Stage mainStage; |
57 | 64 |
|
58 | 65 | Stage imageStage; |
@@ -89,7 +96,8 @@ public void initialize(URL url, ResourceBundle resourceBundle) { |
89 | 96 | buttonExpandAll.setDisable(e.getList().isEmpty()); |
90 | 97 | buttonCollapseAll.setDisable(e.getList().isEmpty()); |
91 | 98 | }); |
92 | | - checkBoxHideEmpty.selectedProperty().addListener((observable, oldValue, newValue) -> updateTreeRootPredicate(newValue)); |
| 99 | + checkBoxHideEmpty.selectedProperty().addListener((observable, oldValue, newValue) -> updateTreeRootPredicate()); |
| 100 | + checkBoxMissingNfoFileIsAWarning.selectedProperty().addListener((observable, oldValue, newValue) -> updateTreeRootPredicate()); |
93 | 101 | startDirectoryComponentController.inputPathProperty().addListener((observable, oldValue, newValue) -> { |
94 | 102 | if (newValue != null) { |
95 | 103 | onButtonGoEvent(null); |
@@ -131,18 +139,11 @@ protected void updateItem(KodiTreeItemContent item, boolean empty) { |
131 | 139 | continue; |
132 | 140 | } |
133 | 141 | var hans = treeView.getTreeItem(c.getAddedSubList().get(0)).getValue(); |
134 | | - log.debug("Selection changed: {}", hans); |
135 | | - if (hans instanceof KodiLevel3TreeItemContent peter) { |
136 | | - log.debug("Handling {}", hans); |
137 | | - if (peter.getCheckResult() instanceof NfoFileContentCheckResult) { |
138 | | - Path nfoFile = ((NfoFileContentCheckResult) peter.getCheckResult()).getNfoFile(); |
| 142 | + log.debug("Selection changed: {} ({})", hans, hans.getClass()); |
| 143 | + if (hans instanceof NfoCheckResultTreeItemContent<?> peter) { |
| 144 | + log.debug("Handling {}", peter); |
| 145 | + Path nfoFile = peter.getCheckResult().getNfoFile(); |
139 | 146 | executor.execute(() -> showImage(nfoFile)); |
140 | | - } else if (peter.getCheckResult() instanceof NfoFileNameCheckResult) { |
141 | | - if (!((NfoFileNameCheckResult) peter.getCheckResult()).getNfoFiles().isEmpty()) { |
142 | | - Path nfoFile = ((NfoFileNameCheckResult) peter.getCheckResult()).getNfoFiles().get(0); |
143 | | - executor.execute(() -> showImage(nfoFile)); |
144 | | - } |
145 | | - } |
146 | 147 | } |
147 | 148 | } |
148 | 149 | }); |
@@ -182,13 +183,15 @@ private void showImageStage(ImageView imageView, String title) { |
182 | 183 | imageStage.show(); |
183 | 184 | } |
184 | 185 |
|
185 | | - private void updateTreeRootPredicate(boolean onlyWarnings) { |
186 | | - treeRoot.setPredicate(buildHideEmptyPredicate(onlyWarnings)); |
| 186 | + private void updateTreeRootPredicate() { |
| 187 | + Platform.runLater(() -> treeRoot.setPredicate(buildHideEmptyPredicate())); |
187 | 188 | } |
188 | 189 |
|
189 | | - private static Predicate<KodiTreeItemContent> buildHideEmptyPredicate(boolean onlyWarnings) { |
| 190 | + private Predicate<KodiTreeItemContent> buildHideEmptyPredicate() { |
190 | 191 | return item -> { |
191 | | - if (onlyWarnings) |
| 192 | + if(item instanceof NfoCheckResultTreeItemContent<?> anotherItem) |
| 193 | + anotherItem.setMissingNfoIsAWarning(checkBoxMissingNfoFileIsAWarning.isSelected()); |
| 194 | + if (checkBoxHideEmpty.isSelected()) |
192 | 195 | return item.hasWarning(); |
193 | 196 | return true; |
194 | 197 | }; |
|
0 commit comments