Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
eb7c54a
Merge pull request #30 from doubleSlashde/develop
Death111 Jul 15, 2019
5f45b9a
Merge pull request #31 from doubleSlashde/develop
Death111 Jul 15, 2019
e808a32
Merge pull request #83 from doubleSlashde/develop
JSchraff Apr 14, 2021
aad505c
Merge pull request #86 from doubleSlashde/develop
JSchraff Apr 14, 2021
11f72c3
add method to get svgPath from XMl
Oct 11, 2022
008a2b0
add Icons to Button
Oct 11, 2022
1f84bcb
add path for RECOURSES in Resources.java
Oct 11, 2022
40a42f6
add svgs
Oct 11, 2022
2715495
remove FontAwesome Imports
Oct 11, 2022
7bfce3f
remove FontAwesome Imports in Fxml and Dependencys in pom
Oct 11, 2022
ec7dbf6
rollback pom to original from Develop remove Dependencys FontAwesome
Oct 11, 2022
c5c26c5
extract method in class
Oct 11, 2022
975befb
add new Svg Icons
Oct 11, 2022
e6892ad
remove getSvgPathWithXML and getNode and extract in own Class
Oct 11, 2022
d2ba4ea
add Icon path to Resources
Oct 11, 2022
a4f33b5
add new Icons to Buttons
Oct 11, 2022
ef9bb02
add new License for Fontawesome Icons
Oct 12, 2022
7dcfdbe
update Fontawesome License name
Oct 12, 2022
8c69489
change wrong url
Oct 13, 2022
c24337b
remove unused exception throws
Oct 13, 2022
d4983fa
add JavaDoc and Exception error message
Oct 13, 2022
1e5f339
add format fix
Oct 13, 2022
63a8ddd
add Icon and Description to Report Button
Oct 13, 2022
e7309fa
add configurable scale
Oct 14, 2022
1d606cc
remove unused import
Oct 14, 2022
520048e
Create maven.yml
DavidDamke Oct 14, 2022
8f4b7e6
test github action
Oct 14, 2022
6930509
Update maven.yml
DavidDamke Oct 14, 2022
3521871
test github action
Oct 14, 2022
0d10a85
Create maven2.yml
DavidDamke Oct 14, 2022
6eef631
Update maven.yml
DavidDamke Oct 14, 2022
bae226a
Merge remote-tracking branch 'origin/master' into feature/removeFontA…
Oct 14, 2022
0db2c83
test github action
Oct 14, 2022
179b4fc
test github action
Oct 14, 2022
88dba8b
small changes
Death111 Oct 16, 2022
8c438a2
Update maven2.yml
DavidDamke Oct 17, 2022
b877358
Update maven2.yml
DavidDamke Oct 17, 2022
a77b24c
Merge remote-tracking branch 'origin/master' into feature/removeFontA…
Oct 17, 2022
1b885ec
format changes
Oct 17, 2022
9dee880
git hubaction test
Oct 17, 2022
b39bc8b
git hubaction test
Oct 17, 2022
25e5431
git hubaction test
Oct 17, 2022
52591df
delete mavenci and create extra branch for ci
Oct 17, 2022
c4fb99f
set svgPath instead of only using the PAthString
Oct 17, 2022
42671ee
test githubaction
Oct 17, 2022
8bf3422
delete testfile
Oct 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 2 additions & 33 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>de.doubleslash</groupId>
Expand Down Expand Up @@ -31,24 +31,6 @@
<relativePath /> <!-- lookup parent from repository -->
</parent>

<repositories>

<!-- Including for fontawesome-->
<repository>
<id>fontawesomefx-repo</id>
<name>FontAwesome Repository</name>
<url>https://dl.bintray.com/jerady/maven</url>
</repository>

<!-- needed to resolve against central first-->
<repository>
<id>central</id>
<name>Maven Central</name>
<layout>default</layout>
<url>https://repo1.maven.org/maven2</url>
</repository>
</repositories>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Expand Down Expand Up @@ -110,20 +92,7 @@
<version>3.3.0</version>
<type>maven-plugin</type>
</dependency>

<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-commons</artifactId>
<version>8.15</version>
</dependency>

<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-fontawesome</artifactId>
<version>4.7.0-5</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -214,4 +183,4 @@
</plugin>
</plugins>
</reporting>
</project>
</project>
4 changes: 3 additions & 1 deletion src/main/java/de/doubleslash/keeptime/common/Licenses.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public enum Licenses {
"./licenses/GNU Lesser General Public License (LGPL), Version 3.0.txt",
"GNU Lesser General Public License Version 3.0",
"https://www.gnu.org/licenses/lgpl-3.0.de.html"),
MIT("./licenses/The MIT License.txt", "The MIT License", "https://opensource.org/licenses/MIT");
MIT("./licenses/The MIT License.txt", "The MIT License", "https://opensource.org/licenses/MIT"),

CC_4_0("./licenses/CC BY 4.0 License.txt", "CC BY 4.0 License", "https://creativecommons.org/licenses/by/4.0/");

private final String path;
private final String name;
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/de/doubleslash/keeptime/common/Resources.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ public enum RESOURCE {
FXML_MANAGE_PROJECT("/layouts/manage-project.fxml"),
FXML_MANAGE_WORK("/layouts/manage-work.fxml"),

SVG_CALENDAR_DAYS_ICON("/svgs/calendar-days.svg"),

SVG_CLOSE_ICON("/svgs/xmark.svg"),

SVG_SETTINGS_ICON("/svgs/gear.svg"),

SVG_MINUS_ICON("/svgs/minus.svg"),

SVG_TRASH_ICON("/svgs/trash-can.svg"),

SVG_PENCIL_ICON("/svgs/pencil.svg"),

SVG_CLIPBOARD("/svgs/clipboard.svg"),

SVG_BUG_ICON("/svgs/bug.svg"),

;

String resourceLocation;
Expand Down
52 changes: 52 additions & 0 deletions src/main/java/de/doubleslash/keeptime/common/SvgNodeProvider.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package de.doubleslash.keeptime.common;

import javafx.scene.Node;
import javafx.scene.shape.SVGPath;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.InputStream;

/**
* Class loads SvgPath from a SvgFile because Java can not load the original svg file as it is.
* <p>
* To load the svg the class extracts the path as string and creates a new SvgPath and returns it.
*/

public class SvgNodeProvider {

public static String getSvgPathWithXMl(Resources.RESOURCE resource) {
String svgPath;
Document document;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db;

try {
db = dbf.newDocumentBuilder();
} catch (ParserConfigurationException e) {
throw new RuntimeException("Tried to build new document", e);
}

try (InputStream inputStream = Resources.getResource(resource).openStream()) {
document = db.parse(inputStream);
NodeList nodeList = document.getElementsByTagName("path");
svgPath = nodeList.item(0).getAttributes().getNamedItem("d").getNodeValue();
} catch (IOException | SAXException e) {
throw new RuntimeException("Could not extract SvgPath from resource " + resource, e);
}
return svgPath;
}

public static Node getSvgNodeWithScale(Resources.RESOURCE resource, Double scaleX, Double scaleY) {
SVGPath iconSvg = new SVGPath();
iconSvg.setContent(getSvgPathWithXMl(resource));
iconSvg.setScaleX(scaleX);
iconSvg.setScaleY(scaleY);
return iconSvg;
}
}
19 changes: 11 additions & 8 deletions src/main/java/de/doubleslash/keeptime/view/AboutController.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@

import java.util.Comparator;

import de.doubleslash.keeptime.common.*;
import javafx.scene.shape.SVGPath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import de.doubleslash.keeptime.ApplicationProperties;
import de.doubleslash.keeptime.Main;
import de.doubleslash.keeptime.common.BrowserHelper;
import de.doubleslash.keeptime.common.FileOpenHelper;
import de.doubleslash.keeptime.common.Licenses;
import de.doubleslash.keeptime.view.license.LicenseTableRow;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
Expand Down Expand Up @@ -57,6 +55,8 @@ public class AboutController {
@FXML
private Button reportBugButton;

@FXML
private SVGPath bugIcon;
@FXML
private Label versionNumberLabel;

Expand All @@ -70,10 +70,10 @@ public class AboutController {

private final ApplicationProperties applicationProperties;

public AboutController (ApplicationProperties applicationProperties) {
this.applicationProperties = applicationProperties;
public AboutController(ApplicationProperties applicationProperties) {
this.applicationProperties = applicationProperties;
}

@FXML
public void initialize() {
LOG.debug("set version label");
Expand All @@ -90,6 +90,9 @@ public void initialize() {

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

//set SvgPath content
bugIcon.setContent(SvgNodeProvider.getSvgPathWithXMl(Resources.RESOURCE.SVG_BUG_ICON));

// licenseColumn
final TableColumn<LicenseTableRow, String> licenseColumn = new TableColumn<>("License");
licenseColumn.setMinWidth(260);
Expand Down Expand Up @@ -149,7 +152,7 @@ public ObservableList<LicenseTableRow> loadLicenseRows() {
licenseRows.add(new LicenseTableRow("spring-boot-starter-data-jpa", Licenses.APACHEV2));
licenseRows.add(new LicenseTableRow("mockito-core", Licenses.MIT));
licenseRows.add(new LicenseTableRow("h2", Licenses.EPLV1));
licenseRows.add(new LicenseTableRow("fontawesomefx", Licenses.APACHEV2));
licenseRows.add(new LicenseTableRow("Font Awesome Icons", Licenses.CC_4_0));

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

Expand Down
43 changes: 32 additions & 11 deletions src/main/java/de/doubleslash/keeptime/view/ReportController.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import de.doubleslash.keeptime.common.DateFormatter;
import de.doubleslash.keeptime.common.Resources;
import de.doubleslash.keeptime.common.Resources.RESOURCE;
import de.doubleslash.keeptime.common.SvgNodeProvider;
import de.doubleslash.keeptime.controller.Controller;
import de.doubleslash.keeptime.exceptions.FXMLLoaderException;
import de.doubleslash.keeptime.model.Model;
Expand All @@ -43,8 +44,6 @@
import de.doubleslash.keeptime.view.worktable.ProjectTableRow;
import de.doubleslash.keeptime.view.worktable.TableRow;
import de.doubleslash.keeptime.view.worktable.WorkTableRow;
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon;
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView;
import javafx.beans.property.ReadOnlyObjectWrapper;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
Expand All @@ -56,6 +55,7 @@
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.DateCell;
import javafx.scene.control.DatePicker;
import javafx.scene.control.Dialog;
Expand Down Expand Up @@ -200,19 +200,22 @@ private void updateReport(final LocalDate dateToShow) {

this.currentDayLabel.setText(DateFormatter.toDayDateString(this.currentReportDate));
final List<Work> currentWorkItems = model.getWorkRepository()
.findByStartDateOrderByStartTimeAsc(this.currentReportDate);
.findByStartDateOrderByStartTimeAsc(this.currentReportDate);

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

final SortedSet<Project> workedProjectsSet = currentWorkItems.stream().map(Work::getProject)
.collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Project::getIndex))));
final SortedSet<Project> workedProjectsSet = currentWorkItems.stream()
.map(Work::getProject)
.collect(Collectors.toCollection(() -> new TreeSet<>(
Comparator.comparing(Project::getIndex))));

long currentWorkSeconds = 0;
long currentSeconds = 0;

for (final Project project : workedProjectsSet) {
final List<Work> onlyCurrentProjectWork = currentWorkItems.stream().filter(w -> w.getProject() == project)
.collect(Collectors.toList());
final List<Work> onlyCurrentProjectWork = currentWorkItems.stream()
.filter(w -> w.getProject() == project)
.collect(Collectors.toList());

final long projectWorkSeconds = controller.calcSeconds(onlyCurrentProjectWork);

Expand Down Expand Up @@ -282,7 +285,12 @@ public void updateItem(final LocalDate item, final boolean empty) {
}

private Button createDeleteWorkButton(final Work w) {
final Button deleteButton = new Button("", new FontAwesomeIconView(FontAwesomeIcon.TRASH));
final Button deleteButton = new Button("",
SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_TRASH_ICON, 0.03, 0.03));
deleteButton.setMaxSize(20, 18);
deleteButton.setMinSize(20, 18);
deleteButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);

deleteButton.setOnAction(e -> {
LOG.info("Delete work clicked.");
final Alert alert = new Alert(AlertType.CONFIRMATION);
Expand All @@ -304,7 +312,12 @@ private Button createDeleteWorkButton(final Work w) {
}

private Button createEditWorkButton(final Work work) {
final Button editButton = new Button("", new FontAwesomeIconView(FontAwesomeIcon.PENCIL));
final Button editButton = new Button("",
SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_PENCIL_ICON, 0.03, 0.03));
editButton.setMaxSize(20, 18);
editButton.setMinSize(20, 18);
editButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);

editButton.setOnAction(e -> {
LOG.info("Edit work clicked.");
final Dialog<Work> dialog = setupEditWorkDialog(work);
Expand Down Expand Up @@ -361,7 +374,11 @@ private GridPane setUpEditWorkGridPane(final Work work, final Dialog<Work> dialo
}

private Button createCopyProjectButton(final List<Work> projectWork) {
final Button copyButton = new Button("", new FontAwesomeIconView(FontAwesomeIcon.CLIPBOARD));
final Button copyButton = new Button("", SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_CLIPBOARD, 0.03, 0.03));
copyButton.setMaxSize(20, 18);
copyButton.setMinSize(20, 18);
copyButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);

final EventHandler<ActionEvent> eventListener = actionEvent -> {
LOG.debug("Copy to Clipboard clicked.");
final ProjectReport pr = new ProjectReport(projectWork.size());
Expand All @@ -381,7 +398,11 @@ private Button createCopyProjectButton(final List<Work> projectWork) {
}

private Node createCopyWorkButton(final Work w) {
final Button copyButton = new Button("", new FontAwesomeIconView(FontAwesomeIcon.CLIPBOARD));
final Button copyButton = new Button("", SvgNodeProvider.getSvgNodeWithScale(RESOURCE.SVG_CLIPBOARD, 0.03, 0.03));
copyButton.setMaxSize(20, 18);
copyButton.setMinSize(20, 18);
copyButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);

final EventHandler<ActionEvent> eventListener = actionEvent -> {
LOG.debug("Copy to Clipboard clicked.");
final Clipboard clipboard = Clipboard.getSystemClipboard();
Expand Down
Loading