Skip to content

Commit d2eaa49

Browse files
committed
PTBAS-738: set tooltup directly during label creation. rename, comments
1 parent f4ec870 commit d2eaa49

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,6 @@ protected void updateItem(List<Project> item, boolean empty) {
282282
for (Project project : item) {
283283
HBox row = createRow(project.getColor(), project.getName());
284284
vbox.getChildren().add(row);
285-
286-
// Set tooltip for the label
287-
Label label = (Label) row.getChildren().get(1);
288-
Tooltip tooltip = new Tooltip(label.getText());
289-
label.setTooltip(tooltip);
290285
}
291286
setGraphic(vbox);
292287
}
@@ -295,6 +290,7 @@ protected void updateItem(List<Project> item, boolean empty) {
295290
private HBox createRow(Color color, String text) {
296291
Circle circle = new Circle(6, color);
297292
Label label = new Label(text);
293+
label.setTooltip(new Tooltip(text));
298294

299295
label.setMaxWidth(Double.MAX_VALUE);
300296
HBox.setHgrow(label, Priority.ALWAYS);
@@ -441,20 +437,20 @@ protected void updateItem(TableRow item, boolean empty) {
441437
}
442438

443439
TextFlow statusFlow = item.syncStatus;
444-
String status = statusFlow.getChildren()
440+
String statusForTooltip = statusFlow.getChildren()
445441
.stream()
446-
.filter(n -> n instanceof Text)
442+
.filter(Text.class::isInstance)
447443
.map(n -> ((Text) n).getText())
448444
.collect(Collectors.joining());
449445

450446
if (!item.bookingHint.isEmpty().get()) {
451447
statusFlow = new TextFlow(statusFlow);
452-
tooltip.setText(status + "\n" + item.bookingHint.get());
448+
tooltip.setText(statusForTooltip + "\n" + item.bookingHint.get());
453449
Text icon = new Text("ⓘ ");
454450
icon.setStyle("-fx-text-fill: #1c2070; -fx-font-size: 14px;");
455451
statusFlow.getChildren().add(0, icon);
456452
} else {
457-
tooltip.setText(status);
453+
tooltip.setText(statusForTooltip);
458454
}
459455

460456
// Fix Cell height not aligning with Textflow
@@ -475,6 +471,7 @@ protected void updateItem(TableRow item, boolean empty) {
475471

476472
mappingTableView.getColumns().addAll(shouldSyncColumn, projectColumn, timeColumn, notesColumn, syncColumn);
477473
mappingTableView.setSelectionModel(null);
474+
mappingTableView.setFocusTraversable(false);
478475
mappingTableView.getColumns().forEach(column -> column.setSortable(false));
479476

480477
saveButton.setOnAction(ae -> {
@@ -638,7 +635,8 @@ private void setUpTimeSpinner(final Spinner<LocalTime> spinner) {
638635
final StringProperty text = spinner.getEditor().textProperty();
639636
try {
640637
stringConverter.fromString(text.get());
641-
spinner.increment(0);
638+
// needed to log in value from editor to spinner
639+
spinner.increment(0); // TODO find better Solution
642640
} catch (final DateTimeParseException ex) {
643641
text.setValue(spinner.getValue().toString());
644642
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@ private void showSyncStage(){
170170
syncStage.setResizable(true);
171171
syncStage.getIcons().add(new Image(Resources.getResource(RESOURCE.ICON_MAIN).toString()));
172172

173-
final Scene settingsScene = new Scene(syncRoot);
174-
settingsScene.addEventFilter(KeyEvent.KEY_PRESSED, ke -> {
173+
final Scene syncScene = new Scene(syncRoot);
174+
syncScene.addEventFilter(KeyEvent.KEY_PRESSED, ke -> {
175175
if (ke.getCode() == KeyCode.ESCAPE) {
176176
LOG.info("pressed ESCAPE");
177177
syncStage.close();
178178
}
179179
});
180180

181-
syncStage.setScene(settingsScene);
181+
syncStage.setScene(syncScene);
182182
syncStage.showAndWait();
183183
} catch (final Exception e) {
184184
throw new FXMLLoaderException(e);

0 commit comments

Comments
 (0)