Skip to content

Commit db44335

Browse files
committed
added functioning Editor to endTimeSpinner
1 parent 82acebd commit db44335

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/java/de/doubleslash/keeptime/view/ManageWorkController.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@ public void initializeWith(final Work work) {
8989
}
9090
});
9191

92+
endTimeSpinner.getEditor().textProperty().addListener((observable, oldValue, newValue) -> {
93+
final LocalTimeStringConverter stringConverter = new LocalTimeStringConverter(FormatStyle.MEDIUM);
94+
final StringProperty text = (StringProperty) observable;
95+
try {
96+
stringConverter.fromString(newValue);
97+
text.setValue(newValue);
98+
endTimeSpinner.increment(0); // TODO find better Solution
99+
} catch (final DateTimeParseException e) {
100+
text.setValue(oldValue);
101+
}
102+
});
103+
92104
startTimeSpinner.setValueFactory(new SpinnerValueFactory<LocalTime>() {
93105

94106
{

0 commit comments

Comments
 (0)