Skip to content

Commit 4e09909

Browse files
author
Martin Plieske
committed
added colored circles before project names in report
1 parent 5c40df6 commit 4e09909

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import javafx.scene.input.ClipboardContent;
3333
import javafx.scene.layout.BorderPane;
3434
import javafx.scene.layout.GridPane;
35+
import javafx.scene.shape.Circle;
3536
import javafx.scene.text.Font;
3637
import javafx.scene.text.FontWeight;
3738
import javafx.util.Callback;
@@ -98,6 +99,10 @@ private void updateReport(final LocalDate newvalue) {
9899

99100
this.gridPane.getChildren().clear();
100101
this.gridPane.getRowConstraints().clear();
102+
this.gridPane.getColumnConstraints().get(0).setPrefWidth(20);
103+
this.gridPane.getColumnConstraints().get(1).setPrefWidth(237);
104+
this.gridPane.getColumnConstraints().get(2).setPrefWidth(154);
105+
this.gridPane.getColumnConstraints().get(3).setPrefWidth(81);
101106

102107
int rowIndex = 0;
103108
long currentWorkSeconds = 0;
@@ -108,7 +113,10 @@ private void updateReport(final LocalDate newvalue) {
108113
for (final Project project : workedProjectsSet) {
109114
final Label projectName = new Label(project.getName());
110115
projectName.setFont(labelFontBold);
111-
this.gridPane.add(projectName, 0, rowIndex);
116+
final Circle circle = new Circle(5, project.getColor());
117+
118+
this.gridPane.add(circle, 0, rowIndex);
119+
this.gridPane.add(projectName, 1, rowIndex);
112120

113121
final List<Work> onlyCurrentProjectWork = currentWorkItems.stream().filter(w -> w.getProject() == project)
114122
.collect(Collectors.toList());
@@ -123,12 +131,12 @@ private void updateReport(final LocalDate newvalue) {
123131

124132
final Label workedTimeLabel = new Label(DateFormatter.secondsToHHMMSS(todaysWorkSeconds));
125133
workedTimeLabel.setFont(labelFontBold);
126-
this.gridPane.add(workedTimeLabel, 2, rowIndex);
134+
this.gridPane.add(workedTimeLabel, 3, rowIndex);
127135

128136
// text will be set later
129137

130138
final Button bProjectReport = createProjectReport();
131-
this.gridPane.add(bProjectReport, 1, rowIndex);
139+
this.gridPane.add(bProjectReport, 2, rowIndex);
132140

133141
rowIndex++;
134142

@@ -143,17 +151,17 @@ private void updateReport(final LocalDate newvalue) {
143151
final Label commentLabel = new Label(currentWorkNote);
144152
commentLabel.setFont(labelFontNormal);
145153
commentLabel.setWrapText(true);
146-
this.gridPane.add(commentLabel, 0, rowIndex);
154+
this.gridPane.add(commentLabel, 1, rowIndex);
147155

148156
final Label fromTillLabel = new Label(DateFormatter.toTimeString(work.getStartTime()) + " - "
149157
+ DateFormatter.toTimeString(work.getEndTime()));
150158
fromTillLabel.setFont(labelFontNormal);
151159
fromTillLabel.setWrapText(true);
152-
this.gridPane.add(fromTillLabel, 1, rowIndex);
160+
this.gridPane.add(fromTillLabel, 2, rowIndex);
153161

154162
final Label workedHoursLabel = new Label(workedHours);
155163
workedHoursLabel.setFont(labelFontNormal);
156-
this.gridPane.add(workedHoursLabel, 2, rowIndex);
164+
this.gridPane.add(workedHoursLabel, 3, rowIndex);
157165

158166
rowIndex++;
159167
}

src/main/resources/report.fxml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
7272
</VBox.margin>
7373
</BorderPane>
74-
<Canvas fx:id="canvas" height="3.0" width="480.0">
74+
<Canvas fx:id="canvas" height="5.0" width="480.0">
7575
<VBox.margin>
7676
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
7777
</VBox.margin>
@@ -85,9 +85,10 @@
8585
<content>
8686
<GridPane fx:id="gridPane" prefWidth="498.0">
8787
<columnConstraints>
88-
<ColumnConstraints hgrow="SOMETIMES" maxWidth="349.0" minWidth="10.0" prefWidth="290.0" />
89-
<ColumnConstraints hgrow="SOMETIMES" maxWidth="243.0" minWidth="10.0" prefWidth="131.0" />
90-
<ColumnConstraints hgrow="SOMETIMES" maxWidth="243.0" minWidth="10.0" prefWidth="77.0" />
88+
<ColumnConstraints hgrow="SOMETIMES" maxWidth="349.0" minWidth="10.0" prefWidth="34.0" />
89+
<ColumnConstraints hgrow="SOMETIMES" maxWidth="374.0" minWidth="0.0" prefWidth="216.0" />
90+
<ColumnConstraints hgrow="SOMETIMES" maxWidth="400.0" minWidth="0.0" prefWidth="146.0" />
91+
<ColumnConstraints hgrow="SOMETIMES" maxWidth="258.0" minWidth="0.0" prefWidth="102.0" />
9192
</columnConstraints>
9293
<rowConstraints>
9394
<RowConstraints maxHeight="57.0" minHeight="4.0" prefHeight="26.0" vgrow="SOMETIMES" />
@@ -97,12 +98,12 @@
9798
<RowConstraints maxHeight="226.0" minHeight="10.0" prefHeight="127.0" vgrow="SOMETIMES" />
9899
</rowConstraints>
99100
<children>
100-
<Label text="99:99:99" GridPane.columnIndex="2" GridPane.rowIndex="1">
101+
<Label text="99:99:99" GridPane.columnIndex="3" GridPane.rowIndex="1">
101102
<font>
102103
<Font name="System Bold" size="15.0" />
103104
</font>
104105
</Label>
105-
<Label layoutX="375.0" layoutY="39.0" text="99:99:99 - 99:99:99" GridPane.columnIndex="1" GridPane.rowIndex="1">
106+
<Label layoutX="375.0" layoutY="39.0" text="99:99:99 - 99:99:99" GridPane.columnIndex="2" GridPane.rowIndex="1">
106107
<font>
107108
<Font size="15.0" />
108109
</font>

0 commit comments

Comments
 (0)