@@ -213,11 +213,7 @@ private HBox createRow(Color color, String text) {
213213
214214 Consumer <Spinner <LocalTime >> spinnerValidConsumer = (Spinner <LocalTime > spinner ) -> {
215215 final boolean isValid = areSecondsOfDayValid (spinner .getValue ().toSecondOfDay ());
216- if (!isValid ) {
217- spinner .setStyle ("-fx-border-color: red; -fx-border-width: 2px; -fx-border-radius: 4px;" );
218- } else {
219- spinner .setStyle ("" ); // Reset to default style
220- }
216+ markNodeValidOrNot (spinner , isValid );
221217 };
222218 timeColumn .setCellFactory (column -> new TableCell <>() {
223219 private final Spinner <LocalTime > timeSpinner = new Spinner <>();
@@ -263,11 +259,8 @@ protected void updateItem(TableRow item, boolean empty) {
263259 notesColumn .setCellValueFactory (data -> new SimpleObjectProperty <>(data .getValue ())); // Placeholder property
264260
265261 Consumer <TextArea > textAreaValid = (TextArea textArea ) -> {
266- if (textArea .getText ().isBlank ()) {
267- textArea .setStyle ("-fx-border-color: red; -fx-border-width: 2px; -fx-border-radius: 4px;" );
268- } else {
269- textArea .setStyle ("" ); // Reset to default style
270- }
262+ final boolean isValid = !textArea .getText ().isBlank ();
263+ markNodeValidOrNot (textArea , isValid );
271264 };
272265 notesColumn .setCellFactory (column -> new TableCell <>() {
273266 private ChangeListener <String > stringChangeListener ;
@@ -299,8 +292,12 @@ protected void updateItem(TableRow item, boolean empty) {
299292 copyHeimatNotes .setTooltip (new Tooltip ("Copy notes" ));
300293 copyHeimatNotes .setOnAction (me -> copyToClipboard (heimatNotesLabel .getText ()));
301294
302- hbox .getChildren ().addAll (copyKeepTimeNotes , new Label ("KeepTime:" ), keepTimeNotesLabel );
303- hbox2 .getChildren ().addAll (copyHeimatNotes , new Label ("HEIMAT:" ), heimatNotesLabel );
295+ final Label keeptimeLabel = new Label ("KeepTime:" );
296+ keeptimeLabel .setMinWidth (60 );
297+ hbox .getChildren ().addAll (copyKeepTimeNotes , keeptimeLabel , keepTimeNotesLabel );
298+ final Label heimatLabel = new Label ("HEIMAT:" );
299+ heimatLabel .setMinWidth (60 );
300+ hbox2 .getChildren ().addAll (copyHeimatNotes , heimatLabel , heimatNotesLabel );
304301 container .getChildren ().addAll (textArea , hbox , hbox2 );
305302 }
306303
@@ -404,6 +401,14 @@ protected List<HeimatController.HeimatErrors> call() {
404401 // TODO offer some way to book time to an additional project?
405402 }
406403
404+ private static void markNodeValidOrNot (final Node textArea , final boolean isValid ) {
405+ String borderColor = "lightgreen" ;
406+ if (!isValid ) {
407+ borderColor = "lightcoral" ;
408+ }
409+ textArea .setStyle ("-fx-border-color: " + borderColor + "; -fx-border-width: 1px; -fx-border-radius: 4px;" );
410+ }
411+
407412 private static boolean areSecondsOfDayValid (final long seconds ) {
408413 long minutes = (seconds / 60 );
409414 final boolean isInvalid = seconds % 60 != 0 || minutes % 15 != 0 || minutes <= 0 ;
0 commit comments