|
21 | 21 | import java.time.format.DateTimeParseException; |
22 | 22 | import java.time.format.FormatStyle; |
23 | 23 |
|
| 24 | +import javafx.scene.control.skin.ComboBoxListViewSkin; |
24 | 25 | import org.slf4j.Logger; |
25 | 26 | import org.slf4j.LoggerFactory; |
26 | 27 |
|
27 | | -import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin; |
28 | | - |
29 | 28 | import de.doubleslash.keeptime.common.ColorHelper; |
30 | 29 | import de.doubleslash.keeptime.common.StyleUtils; |
31 | 30 | import de.doubleslash.keeptime.model.Model; |
@@ -229,21 +228,22 @@ public Project fromString(final String string) { |
229 | 228 | // needs to set again because editable is ignored from fxml because of custom preselection of current Project |
230 | 229 | projectComboBox.setEditable(true); |
231 | 230 |
|
232 | | - projectComboBox.valueProperty().addListener( |
233 | | - (final ObservableValue<? extends Project> observable, final Project oldValue, final Project newValue) -> { |
234 | | - if (newValue == null) { |
235 | | - return; |
236 | | - } |
| 231 | + projectComboBox.valueProperty() |
| 232 | + .addListener((final ObservableValue<? extends Project> observable, final Project oldValue, |
| 233 | + final Project newValue) -> { |
| 234 | + if (newValue == null) { |
| 235 | + return; |
| 236 | + } |
237 | 237 |
|
238 | | - selectedProject = newValue; |
239 | | - comboChange = true; |
240 | | - // needed to avoid exception on empty textfield https://bugs.openjdk.java.net/browse/JDK-8081700 |
241 | | - Platform.runLater(() -> { |
242 | | - setTextColor(projectComboBox.getEditor(), newValue.getColor()); |
243 | | - }); |
244 | | - } |
| 238 | + selectedProject = newValue; |
| 239 | + comboChange = true; |
| 240 | + // needed to avoid exception on empty textfield https://bugs.openjdk.java.net/browse/JDK-8081700 |
| 241 | + Platform.runLater(() -> { |
| 242 | + setTextColor(projectComboBox.getEditor(), newValue.getColor()); |
| 243 | + }); |
| 244 | + } |
245 | 245 |
|
246 | | - ); |
| 246 | + ); |
247 | 247 |
|
248 | 248 | enableStrgA_combo(); |
249 | 249 |
|
@@ -290,17 +290,21 @@ public void changed(final ObservableValue<? extends String> observable, final St |
290 | 290 | }); |
291 | 291 |
|
292 | 292 | // manages Focusbehaviour |
293 | | - projectComboBox.getEditor().focusedProperty().addListener((final ObservableValue<? extends Boolean> observable, |
294 | | - final Boolean oldIsFocused, final Boolean newIsFocused) -> { |
295 | | - if (newIsFocused) { |
296 | | - // needed to avoid exception on empty textfield https://bugs.openjdk.java.net/browse/JDK-8081700 |
297 | | - Platform.runLater(() -> projectComboBox.getEditor().selectAll()); |
298 | | - } else { |
299 | | - // needed to avoid exception on empty textfield https://bugs.openjdk.java.net/browse/JDK-8081700 |
300 | | - Platform.runLater(() -> projectComboBox.hide()); |
301 | | - } |
302 | | - |
303 | | - }); |
| 293 | + projectComboBox.getEditor() |
| 294 | + .focusedProperty() |
| 295 | + .addListener((final ObservableValue<? extends Boolean> observable, final Boolean oldIsFocused, |
| 296 | + final Boolean newIsFocused) -> { |
| 297 | + if (newIsFocused) { |
| 298 | + // needed to avoid exception on empty textfield |
| 299 | + // https://bugs.openjdk.java.net/browse/JDK-8081700 |
| 300 | + Platform.runLater(() -> projectComboBox.getEditor().selectAll()); |
| 301 | + } else { |
| 302 | + // needed to avoid exception on empty textfield |
| 303 | + // https://bugs.openjdk.java.net/browse/JDK-8081700 |
| 304 | + Platform.runLater(() -> projectComboBox.hide()); |
| 305 | + } |
| 306 | + |
| 307 | + }); |
304 | 308 |
|
305 | 309 | // on |
306 | 310 | projectComboBox.setOnKeyReleased(ke -> { |
|
0 commit comments