Skip to content

Commit b5ca8f6

Browse files
ddamkeddamke
authored andcommitted
resolve merge conflicts
2 parents 6cda75c + 825e542 commit b5ca8f6

File tree

11 files changed

+486
-204
lines changed

11 files changed

+486
-204
lines changed

src/main/java/de/doubleslash/keeptime/common/Licenses.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,9 @@ public enum Licenses {
3131
"./licenses/GNU Lesser General Public License (LGPL), Version 3.0.txt",
3232
"GNU Lesser General Public License Version 3.0",
3333
"https://www.gnu.org/licenses/lgpl-3.0.de.html"),
34-
MIT("./licenses/The MIT License.txt",
35-
"The MIT License",
36-
"https://opensource.org/licenses/MIT"),
34+
MIT("./licenses/The MIT License.txt", "The MIT License", "https://opensource.org/licenses/MIT"),
3735

38-
FONTAWESOME("./licenses/Fontawesome Icons — CC BY 4.0 License.txt",
39-
"Fontawesome Icons — CC BY 4.0 License ",
40-
"http://creativecommons.org/licenses/by/4.0/");
36+
CC_4_0("./licenses/CC BY 4.0 License.txt", "CC BY 4.0 License", "https://creativecommons.org/licenses/by/4.0/");
4137

4238
private final String path;
4339
private final String name;

src/main/java/de/doubleslash/keeptime/common/Resources.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,23 @@ public enum RESOURCE {
4040
FXML_ABOUT("/layouts/about.fxml"),
4141
FXML_MANAGE_PROJECT("/layouts/manage-project.fxml"),
4242
FXML_MANAGE_WORK("/layouts/manage-work.fxml"),
43+
4344
SVG_CALENDAR_DAYS_ICON("/svgs/calendar-days.svg"),
45+
4446
SVG_CLOSE_ICON("/svgs/xmark.svg"),
47+
4548
SVG_SETTINGS_ICON("/svgs/gear.svg"),
49+
4650
SVG_MINUS_ICON("/svgs/minus.svg"),
51+
4752
SVG_TRASH_ICON("/svgs/trash-can.svg"),
53+
4854
SVG_PENCIL_ICON("/svgs/pencil.svg"),
49-
SVG_FLOPPY_DISK_ICON("/svgs/floppy-disk.svg"),
50-
SVG_BUG_ICON("/svgs/bug.svg")
55+
56+
SVG_CLIPBOARD("/svgs/clipboard.svg"),
57+
58+
SVG_BUG_ICON("/svgs/bug.svg"),
59+
5160
;
5261

5362
String resourceLocation;

src/main/java/de/doubleslash/keeptime/common/SvgNodeProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import java.io.InputStream;
1414

1515
/**
16-
* class loads SvgPath from a SvgFile because Java can not load the original svg file as it is.
16+
* Class loads SvgPath from a SvgFile because Java can not load the original svg file as it is.
1717
* <p>
1818
* To load the svg the class extracts the path as string and creates a new SvgPath and returns it.
1919
*/
@@ -42,7 +42,7 @@ public static String getSvgPathWithXMl(Resources.RESOURCE resource) {
4242
return svgPath;
4343
}
4444

45-
public static Node getSvgNodeWithScale(Resources.RESOURCE resource, Double scaleX , Double scaleY) {
45+
public static Node getSvgNodeWithScale(Resources.RESOURCE resource, Double scaleX, Double scaleY) {
4646
SVGPath iconSvg = new SVGPath();
4747
iconSvg.setContent(getSvgPathWithXMl(resource));
4848
iconSvg.setScaleX(scaleX);

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

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import java.util.Comparator;
2020

2121
import de.doubleslash.keeptime.common.*;
22-
import javafx.scene.control.*;
22+
import javafx.scene.shape.SVGPath;
2323
import org.slf4j.Logger;
2424
import org.slf4j.LoggerFactory;
2525
import org.springframework.stereotype.Component;
@@ -29,7 +29,14 @@
2929
import javafx.collections.FXCollections;
3030
import javafx.collections.ObservableList;
3131
import javafx.fxml.FXML;
32+
import javafx.scene.control.Alert;
3233
import javafx.scene.control.Alert.AlertType;
34+
import javafx.scene.control.Button;
35+
import javafx.scene.control.Hyperlink;
36+
import javafx.scene.control.Label;
37+
import javafx.scene.control.TableCell;
38+
import javafx.scene.control.TableColumn;
39+
import javafx.scene.control.TableView;
3340
import javafx.scene.control.cell.PropertyValueFactory;
3441
import javafx.scene.input.MouseButton;
3542
import javafx.scene.layout.Region;
@@ -47,6 +54,9 @@ public class AboutController {
4754

4855
@FXML
4956
private Button reportBugButton;
57+
58+
@FXML
59+
private SVGPath bugIcon;
5060
@FXML
5161
private Label versionNumberLabel;
5262

@@ -60,10 +70,10 @@ public class AboutController {
6070

6171
private final ApplicationProperties applicationProperties;
6272

63-
public AboutController (ApplicationProperties applicationProperties) {
64-
this.applicationProperties = applicationProperties;
73+
public AboutController(ApplicationProperties applicationProperties) {
74+
this.applicationProperties = applicationProperties;
6575
}
66-
76+
6777
@FXML
6878
public void initialize() {
6979
LOG.debug("set version label");
@@ -80,6 +90,9 @@ public void initialize() {
8090

8191
nameColumn.setCellValueFactory(new PropertyValueFactory<>("name"));
8292

93+
//set SvgPath content
94+
bugIcon.setContent(SvgNodeProvider.getSvgPathWithXMl(Resources.RESOURCE.SVG_BUG_ICON));
95+
8396
// licenseColumn
8497
final TableColumn<LicenseTableRow, String> licenseColumn = new TableColumn<>("License");
8598
licenseColumn.setMinWidth(260);
@@ -139,7 +152,7 @@ public ObservableList<LicenseTableRow> loadLicenseRows() {
139152
licenseRows.add(new LicenseTableRow("spring-boot-starter-data-jpa", Licenses.APACHEV2));
140153
licenseRows.add(new LicenseTableRow("mockito-core", Licenses.MIT));
141154
licenseRows.add(new LicenseTableRow("h2", Licenses.EPLV1));
142-
licenseRows.add(new LicenseTableRow("Fontawesome", Licenses.FONTAWESOME));
155+
licenseRows.add(new LicenseTableRow("Font Awesome Icons", Licenses.CC_4_0));
143156

144157
licenseRows.sort(Comparator.comparing(LicenseTableRow::getName));
145158

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

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
import java.util.TreeSet;
2626
import java.util.stream.Collectors;
2727

28-
import de.doubleslash.keeptime.common.SvgNodeProvider;
29-
import javafx.scene.control.*;
3028
import org.slf4j.Logger;
3129
import org.slf4j.LoggerFactory;
3230
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,6 +35,7 @@
3735
import de.doubleslash.keeptime.common.DateFormatter;
3836
import de.doubleslash.keeptime.common.Resources;
3937
import de.doubleslash.keeptime.common.Resources.RESOURCE;
38+
import de.doubleslash.keeptime.common.SvgNodeProvider;
4039
import de.doubleslash.keeptime.controller.Controller;
4140
import de.doubleslash.keeptime.exceptions.FXMLLoaderException;
4241
import de.doubleslash.keeptime.model.Model;
@@ -52,7 +51,20 @@
5251
import javafx.fxml.FXMLLoader;
5352
import javafx.scene.Node;
5453
import javafx.scene.canvas.Canvas;
54+
import javafx.scene.control.Alert;
5555
import javafx.scene.control.Alert.AlertType;
56+
import javafx.scene.control.Button;
57+
import javafx.scene.control.ButtonType;
58+
import javafx.scene.control.ContentDisplay;
59+
import javafx.scene.control.DateCell;
60+
import javafx.scene.control.DatePicker;
61+
import javafx.scene.control.Dialog;
62+
import javafx.scene.control.Label;
63+
import javafx.scene.control.Tooltip;
64+
import javafx.scene.control.TreeItem;
65+
import javafx.scene.control.TreeTableCell;
66+
import javafx.scene.control.TreeTableColumn;
67+
import javafx.scene.control.TreeTableView;
5668
import javafx.scene.control.cell.TreeItemPropertyValueFactory;
5769
import javafx.scene.input.Clipboard;
5870
import javafx.scene.input.ClipboardContent;
@@ -63,6 +75,7 @@
6375
import javafx.scene.shape.Circle;
6476
import javafx.stage.Stage;
6577
import javafx.util.Callback;
78+
6679
@Component
6780
public class ReportController {
6881

@@ -187,19 +200,22 @@ private void updateReport(final LocalDate dateToShow) {
187200

188201
this.currentDayLabel.setText(DateFormatter.toDayDateString(this.currentReportDate));
189202
final List<Work> currentWorkItems = model.getWorkRepository()
190-
.findByStartDateOrderByStartTimeAsc(this.currentReportDate);
203+
.findByStartDateOrderByStartTimeAsc(this.currentReportDate);
191204

192205
colorTimeLine.update(currentWorkItems, controller.calcSeconds(currentWorkItems));
193206

194-
final SortedSet<Project> workedProjectsSet = currentWorkItems.stream().map(Work::getProject)
195-
.collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Project::getIndex))));
207+
final SortedSet<Project> workedProjectsSet = currentWorkItems.stream()
208+
.map(Work::getProject)
209+
.collect(Collectors.toCollection(() -> new TreeSet<>(
210+
Comparator.comparing(Project::getIndex))));
196211

197212
long currentWorkSeconds = 0;
198213
long currentSeconds = 0;
199214

200215
for (final Project project : workedProjectsSet) {
201-
final List<Work> onlyCurrentProjectWork = currentWorkItems.stream().filter(w -> w.getProject() == project)
202-
.collect(Collectors.toList());
216+
final List<Work> onlyCurrentProjectWork = currentWorkItems.stream()
217+
.filter(w -> w.getProject() == project)
218+
.collect(Collectors.toList());
203219

204220
final long projectWorkSeconds = controller.calcSeconds(onlyCurrentProjectWork);
205221

@@ -269,11 +285,12 @@ public void updateItem(final LocalDate item, final boolean empty) {
269285
}
270286

271287
private Button createDeleteWorkButton(final Work w) {
272-
final Button deleteButton;
273-
deleteButton = new Button("", SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_TRASH_ICON,0.03,0.03));
288+
final Button deleteButton = new Button("",
289+
SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_TRASH_ICON, 0.03, 0.03));
274290
deleteButton.setMaxSize(20, 18);
275291
deleteButton.setMinSize(20, 18);
276292
deleteButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
293+
277294
deleteButton.setOnAction(e -> {
278295
LOG.info("Delete work clicked.");
279296
final Alert alert = new Alert(AlertType.CONFIRMATION);
@@ -295,10 +312,12 @@ private Button createDeleteWorkButton(final Work w) {
295312
}
296313

297314
private Button createEditWorkButton(final Work work) {
298-
final Button editButton = new Button("",SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_PENCIL_ICON, 0.03 ,0.03));
315+
final Button editButton = new Button("",
316+
SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_PENCIL_ICON, 0.03, 0.03));
299317
editButton.setMaxSize(20, 18);
300318
editButton.setMinSize(20, 18);
301319
editButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
320+
302321
editButton.setOnAction(e -> {
303322
LOG.info("Edit work clicked.");
304323
final Dialog<Work> dialog = setupEditWorkDialog(work);
@@ -355,10 +374,11 @@ private GridPane setUpEditWorkGridPane(final Work work, final Dialog<Work> dialo
355374
}
356375

357376
private Button createCopyProjectButton(final List<Work> projectWork) {
358-
final Button copyButton = new Button("", SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_FLOPPY_DISK_ICON, 0.03 ,0.03));
377+
final Button copyButton = new Button("", SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_CLIPBOARD, 0.03, 0.03));
359378
copyButton.setMaxSize(20, 18);
360379
copyButton.setMinSize(20, 18);
361380
copyButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
381+
362382
final EventHandler<ActionEvent> eventListener = actionEvent -> {
363383
LOG.debug("Copy to Clipboard clicked.");
364384
final ProjectReport pr = new ProjectReport(projectWork.size());
@@ -378,7 +398,7 @@ private Button createCopyProjectButton(final List<Work> projectWork) {
378398
}
379399

380400
private Node createCopyWorkButton(final Work w) {
381-
final Button copyButton = new Button("", SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_FLOPPY_DISK_ICON, 0.03 ,0.03));
401+
final Button copyButton = new Button("", SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_CLIPBOARD, 0.03, 0.03));
382402
copyButton.setMaxSize(20, 18);
383403
copyButton.setMinSize(20, 18);
384404
copyButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);

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

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import de.doubleslash.keeptime.common.*;
2626
import javafx.scene.control.*;
27+
import javafx.scene.shape.SVGPath;
2728
import org.slf4j.Logger;
2829
import org.slf4j.LoggerFactory;
2930
import org.springframework.beans.factory.annotation.Autowired;
@@ -70,7 +71,6 @@
7071
import javafx.stage.Modality;
7172
import javafx.stage.Stage;
7273

73-
7474
@Component
7575
public class ViewController {
7676
private static final Logger LOG = LoggerFactory.getLogger(ViewController.class);
@@ -112,6 +112,19 @@ public class ViewController {
112112
private Button settingsButton;
113113
@FXML
114114
private Button calendarButton;
115+
116+
@FXML
117+
private SVGPath calendarIcon;
118+
119+
@FXML
120+
private SVGPath settingsIcon;
121+
122+
@FXML
123+
private SVGPath minimizeIcon;
124+
125+
@FXML
126+
private SVGPath closeIcon;
127+
115128
@FXML
116129
private TextArea textArea;
117130

@@ -184,16 +197,16 @@ private void initialize() {
184197
calendarButton.setOnAction(ae -> calendarClicked());
185198

186199
calendarButton.textFillProperty().bind(fontColorProperty);
187-
calendarButton.setGraphic(SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_CALENDAR_DAYS_ICON, 0.03 ,0.03));
200+
calendarButton.setGraphic(SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_CALENDAR_DAYS_ICON, 0.03, 0.03));
188201

189202
closeButton.textFillProperty().bind(fontColorProperty);
190-
closeButton.setGraphic(SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_CLOSE_ICON, 0.03 ,0.03));
203+
closeButton.setGraphic(SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_CLOSE_ICON, 0.03, 0.03));
191204

192205
settingsButton.textFillProperty().bind(fontColorProperty);
193-
settingsButton.setGraphic(SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_SETTINGS_ICON, 0.03 ,0.03));
206+
settingsButton.setGraphic(SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_SETTINGS_ICON, 0.03, 0.03));
194207

195208
minimizeButton.textFillProperty().bind(fontColorProperty);
196-
minimizeButton.setGraphic(SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_MINUS_ICON , 0.03 ,0.03));
209+
minimizeButton.setGraphic(SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_MINUS_ICON, 0.03, 0.03));
197210

198211
final Runnable updateMainBackgroundColor = this::runUpdateMainBackgroundColor;
199212

@@ -267,17 +280,18 @@ private void initialize() {
267280
mainStage.setY(mouseEvent.getScreenY() + dragDelta.y);
268281
});
269282

270-
bigTimeLabel.textProperty().bind(Bindings.createStringBinding(
271-
() -> DateFormatter.secondsToHHMMSS(activeWorkSecondsProperty.get()), activeWorkSecondsProperty));
283+
bigTimeLabel.textProperty()
284+
.bind(Bindings.createStringBinding(
285+
() -> DateFormatter.secondsToHHMMSS(activeWorkSecondsProperty.get()),
286+
activeWorkSecondsProperty));
272287

273288
// update ui each second
274289
new Interval(1).registerCallBack(() -> {
275290
final LocalDateTime now = LocalDateTime.now();
276291
model.activeWorkItem.get().setEndTime(now); // FIXME not good to change model
277292

278-
final long currentWorkSeconds = Duration
279-
.between(model.activeWorkItem.get().getStartTime(), model.activeWorkItem.get().getEndTime())
280-
.getSeconds();
293+
final long currentWorkSeconds = Duration.between(model.activeWorkItem.get().getStartTime(),
294+
model.activeWorkItem.get().getEndTime()).getSeconds();
281295
activeWorkSecondsProperty.set(currentWorkSeconds);
282296
final long todayWorkingSeconds = controller.calcTodaysWorkSeconds();
283297
final long todaySeconds = controller.calcTodaysSeconds();

src/main/resources/layouts/about.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<Pane layoutX="280" layoutY="227" maxHeight="50.0" maxWidth="135.0" minHeight="50.0" minWidth="50.0" prefHeight="50.0" prefWidth="135.0">
6464
<children>
6565
<Label contentDisplay="CENTER" layoutY="-5.0" maxHeight="60.0" maxWidth="1.7976931348623157E308" minHeight="50.0" minWidth="50.0" prefHeight="60.0" prefWidth="107.0" text="Found a Bug ?" />
66-
<SVGPath content="M256 0c53 0 96 43 96 96v3.6c0 15.7-12.7 28.4-28.4 28.4H188.4c-15.7 0-28.4-12.7-28.4-28.4V96c0-53 43-96 96-96zM41.4 105.4c12.5-12.5 32.8-12.5 45.3 0l64 64c.7 .7 1.3 1.4 1.9 2.1c14.2-7.3 30.4-11.4 47.5-11.4H312c17.1 0 33.2 4.1 47.5 11.4c.6-.7 1.2-1.4 1.9-2.1l64-64c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3l-64 64c-.7 .7-1.4 1.3-2.1 1.9c6.2 12 10.1 25.3 11.1 39.5H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H416c0 24.6-5.5 47.8-15.4 68.6c2.2 1.3 4.2 2.9 6 4.8l64 64c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0l-63.1-63.1c-24.5 21.8-55.8 36.2-90.3 39.6V240c0-8.8-7.2-16-16-16s-16 7.2-16 16V479.2c-34.5-3.4-65.8-17.8-90.3-39.6L86.6 502.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l64-64c1.9-1.9 3.9-3.4 6-4.8C101.5 367.8 96 344.6 96 320H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H96.3c1.1-14.1 5-27.5 11.1-39.5c-.7-.6-1.4-1.2-2.1-1.9l-64-64c-12.5-12.5-12.5-32.8 0-45.3zM256 0c53 0 96 43 96 96v3.6c0 15.7-12.7 28.4-28.4 28.4H188.4c-15.7 0-28.4-12.7-28.4-28.4V96c0-53 43-96 96-96zM41.4 105.4c12.5-12.5 32.8-12.5 45.3 0l64 64c.7 .7 1.3 1.4 1.9 2.1c14.2-7.3 30.4-11.4 47.5-11.4H312c17.1 0 33.2 4.1 47.5 11.4c.6-.7 1.2-1.4 1.9-2.1l64-64c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3l-64 64c-.7 .7-1.4 1.3-2.1 1.9c6.2 12 10.1 25.3 11.1 39.5H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H416c0 24.6-5.5 47.8-15.4 68.6c2.2 1.3 4.2 2.9 6 4.8l64 64c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0l-63.1-63.1c-24.5 21.8-55.8 36.2-90.3 39.6V240c0-8.8-7.2-16-16-16s-16 7.2-16 16V479.2c-34.5-3.4-65.8-17.8-90.3-39.6L86.6 502.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l64-64c1.9-1.9 3.9-3.4 6-4.8C101.5 367.8 96 344.6 96 320H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H96.3c1.1-14.1 5-27.5 11.1-39.5c-.7-.6-1.4-1.2-2.1-1.9l-64-64c-12.5-12.5-12.5-32.8 0-45.3z" layoutX="-160.0" layoutY="-231.0" scaleX="0.04" scaleY="0.04" />
66+
<SVGPath fx:id="bugIcon" layoutX="-160.0" layoutY="-231.0" scaleX="0.04" scaleY="0.04" />
6767
</children>
6868
</Pane>
6969
<TableView fx:id="licenseTableView" focusTraversable="false" layoutX="39.0" layoutY="302.0" prefHeight="188.0" prefWidth="437.0" />

0 commit comments

Comments
 (0)