Skip to content

Commit 4c95d2b

Browse files
author
Jan Schraff
committed
Merge branch 'develop' into bugfix/strg_combos_not_working_in_edit_work_dd
2 parents 9a3598c + b91a240 commit 4c95d2b

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,17 @@ public void changed(final ObservableValue<? extends String> observable, final St
258258
projectComboBox.setOnShown(null);
259259
});
260260

261+
// on
262+
projectComboBox.setOnKeyReleased(ke -> {
263+
if (ke.getCode() == KeyCode.ENTER && projectComboBox.getSelectionModel().isEmpty()) {
264+
if (!projectComboBox.getItems().isEmpty()) {
265+
projectComboBox.getSelectionModel().selectFirst();
266+
comboChange = true;
267+
}
268+
}
269+
270+
});
271+
261272
}
262273

263274
public void initializeWith(final Work work) {

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ public class ReportController {
118118

119119
private LocalDate currentReportDate;
120120

121+
private final TreeItem<TableRow> rootItem = new TreeItem<>();
122+
121123
@Autowired
122124
public ReportController(final Model model, final Controller controller) {
123125
this.model = model;
@@ -185,11 +187,13 @@ protected void updateItem(final TableRow item, final boolean empty) {
185187

186188
workTableTreeView.setShowRoot(false);
187189

190+
workTableTreeView.setRoot(rootItem);
191+
rootItem.setExpanded(true);
188192
}
189193

190194
private void updateReport(final LocalDate dateToShow) {
191195
this.currentReportDate = dateToShow;
192-
196+
rootItem.getChildren().clear();
193197
reportRoot.requestFocus();
194198

195199
this.currentDayLabel.setText(DateFormatter.toDayDateString(this.currentReportDate));
@@ -204,8 +208,6 @@ private void updateReport(final LocalDate dateToShow) {
204208
long currentWorkSeconds = 0;
205209
long currentSeconds = 0;
206210

207-
final TreeItem<TableRow> root = new TreeItem<>();
208-
209211
for (final Project project : workedProjectsSet) {
210212
final List<Work> onlyCurrentProjectWork = currentWorkItems.stream().filter(w -> w.getProject() == project)
211213
.collect(Collectors.toList());
@@ -234,12 +236,10 @@ private void updateReport(final LocalDate dateToShow) {
234236
}
235237

236238
projectRow.setExpanded(true);
237-
root.getChildren().add(projectRow);
239+
rootItem.getChildren().add(projectRow);
238240

239241
}
240242

241-
root.setExpanded(true);
242-
workTableTreeView.setRoot(root);
243243
this.currentDayTimeLabel.setText(DateFormatter.secondsToHHMMSS(currentSeconds));
244244
this.currentDayWorkTimeLabel.setText(DateFormatter.secondsToHHMMSS(currentWorkSeconds));
245245

src/main/resources/layouts/manage-work.fxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<?import javafx.scene.layout.RowConstraints?>
1212
<?import javafx.scene.text.Font?>
1313

14-
<GridPane fx:id="grid" hgap="5.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="214.0" prefWidth="371.0" vgap="5.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.doubleslash.keeptime.view.ManageWorkController">
14+
<GridPane fx:id="grid" hgap="5.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="214.0" prefWidth="371.0" vgap="5.0" xmlns="http://javafx.com/javafx/8.0.202-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.doubleslash.keeptime.view.ManageWorkController">
1515
<columnConstraints>
1616
<ColumnConstraints hgrow="SOMETIMES" />
1717
<ColumnConstraints hgrow="SOMETIMES" maxWidth="200.0" minWidth="100.0" prefWidth="150.0" />
@@ -50,7 +50,7 @@
5050
</Label>
5151
<Spinner fx:id="startTimeSpinner" editable="true" GridPane.columnIndex="2" />
5252
<Spinner fx:id="endTimeSpinner" editable="true" GridPane.columnIndex="2" GridPane.rowIndex="1" />
53-
<TextArea fx:id="noteTextArea" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="4" />
53+
<TextArea fx:id="noteTextArea" prefHeight="200.0" prefWidth="200.0" wrapText="true" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="4" />
5454
<Label text="Changing the times may result in overlapping times!" textFill="#ffa100" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="2">
5555
<font>
5656
<Font name="Open Sans Regular" size="12.0" />

0 commit comments

Comments
 (0)