Skip to content

Commit a691dfc

Browse files
author
Martin Plieske
committed
put color circle and project name into hbox
1 parent 7785578 commit a691dfc

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

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

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import javafx.event.ActionEvent;
2222
import javafx.event.EventHandler;
2323
import javafx.fxml.FXML;
24+
import javafx.geometry.Insets;
25+
import javafx.geometry.Pos;
2426
import javafx.scene.Node;
2527
import javafx.scene.canvas.Canvas;
2628
import javafx.scene.control.Button;
@@ -32,6 +34,7 @@
3234
import javafx.scene.input.ClipboardContent;
3335
import javafx.scene.layout.BorderPane;
3436
import javafx.scene.layout.GridPane;
37+
import javafx.scene.layout.HBox;
3538
import javafx.scene.shape.Circle;
3639
import javafx.scene.text.Font;
3740
import javafx.scene.text.FontWeight;
@@ -99,10 +102,7 @@ private void updateReport(final LocalDate newvalue) {
99102

100103
this.gridPane.getChildren().clear();
101104
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);
105+
this.gridPane.getColumnConstraints().get(0).setPrefWidth(247);
106106

107107
int rowIndex = 0;
108108
long currentWorkSeconds = 0;
@@ -115,8 +115,15 @@ private void updateReport(final LocalDate newvalue) {
115115
projectName.setFont(labelFontBold);
116116
final Circle circle = new Circle(5, project.getColor());
117117

118-
this.gridPane.add(circle, 0, rowIndex);
119-
this.gridPane.add(projectName, 1, rowIndex);
118+
final HBox nameHBox = new HBox();
119+
nameHBox.setAlignment(Pos.CENTER_LEFT);
120+
nameHBox.setPadding(new Insets(0, 0, 0, 5));
121+
nameHBox.setSpacing(5);
122+
123+
nameHBox.getChildren().add(circle);
124+
nameHBox.getChildren().add(projectName);
125+
126+
this.gridPane.add(nameHBox, 0, rowIndex);
120127

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

132139
final Label workedTimeLabel = new Label(DateFormatter.secondsToHHMMSS(todaysWorkSeconds));
133140
workedTimeLabel.setFont(labelFontBold);
134-
this.gridPane.add(workedTimeLabel, 3, rowIndex);
141+
this.gridPane.add(workedTimeLabel, 2, rowIndex);
135142

136143
// text will be set later
137144

138145
final Button bProjectReport = createProjectReport();
139-
this.gridPane.add(bProjectReport, 2, rowIndex);
146+
this.gridPane.add(bProjectReport, 1, rowIndex);
140147

141148
rowIndex++;
142149

@@ -151,17 +158,17 @@ private void updateReport(final LocalDate newvalue) {
151158
final Label commentLabel = new Label(currentWorkNote);
152159
commentLabel.setFont(labelFontNormal);
153160
commentLabel.setWrapText(true);
154-
this.gridPane.add(commentLabel, 1, rowIndex);
161+
this.gridPane.add(commentLabel, 0, rowIndex);
155162

156163
final Label fromTillLabel = new Label(DateFormatter.toTimeString(work.getStartTime()) + " - "
157164
+ DateFormatter.toTimeString(work.getEndTime()));
158165
fromTillLabel.setFont(labelFontNormal);
159166
fromTillLabel.setWrapText(true);
160-
this.gridPane.add(fromTillLabel, 2, rowIndex);
167+
this.gridPane.add(fromTillLabel, 1, rowIndex);
161168

162169
final Label workedHoursLabel = new Label(workedHours);
163170
workedHoursLabel.setFont(labelFontNormal);
164-
this.gridPane.add(workedHoursLabel, 3, rowIndex);
171+
this.gridPane.add(workedHoursLabel, 2, rowIndex);
165172

166173
rowIndex++;
167174
}

src/main/resources/report.fxml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
<content>
8686
<GridPane fx:id="gridPane" prefWidth="498.0">
8787
<columnConstraints>
88-
<ColumnConstraints hgrow="SOMETIMES" maxWidth="349.0" minWidth="10.0" prefWidth="34.0" />
8988
<ColumnConstraints hgrow="SOMETIMES" maxWidth="374.0" minWidth="0.0" prefWidth="216.0" />
9089
<ColumnConstraints hgrow="SOMETIMES" maxWidth="400.0" minWidth="0.0" prefWidth="146.0" />
9190
<ColumnConstraints hgrow="SOMETIMES" maxWidth="258.0" minWidth="0.0" prefWidth="102.0" />
@@ -98,12 +97,12 @@
9897
<RowConstraints maxHeight="226.0" minHeight="10.0" prefHeight="127.0" vgrow="SOMETIMES" />
9998
</rowConstraints>
10099
<children>
101-
<Label text="99:99:99" GridPane.columnIndex="3" GridPane.rowIndex="1">
100+
<Label text="99:99:99" GridPane.columnIndex="2" GridPane.rowIndex="1">
102101
<font>
103102
<Font name="System Bold" size="15.0" />
104103
</font>
105104
</Label>
106-
<Label layoutX="375.0" layoutY="39.0" text="99:99:99 - 99:99:99" GridPane.columnIndex="2" GridPane.rowIndex="1">
105+
<Label layoutX="375.0" layoutY="39.0" text="99:99:99 - 99:99:99" GridPane.columnIndex="1" GridPane.rowIndex="1">
107106
<font>
108107
<Font size="15.0" />
109108
</font>

0 commit comments

Comments
 (0)