Skip to content

Commit eb7c54a

Browse files
authored
Merge pull request #30 from doubleSlashde/develop
Develop
2 parents 90ace91 + 5dcdc97 commit eb7c54a

File tree

68 files changed

+5092
-1099
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+5092
-1099
lines changed

COPYING

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

assembly.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
3+
4+
<id>bin</id>
5+
6+
<formats>
7+
<format>zip</format>
8+
</formats>
9+
10+
<includeBaseDirectory>false</includeBaseDirectory>
11+
12+
<fileSets>
13+
<fileSet>
14+
<directory>${project.basedir}/src/main/resources/licenses</directory>
15+
<outputDirectory>licenses</outputDirectory>
16+
</fileSet>
17+
</fileSets>
18+
19+
<dependencySets>
20+
<dependencySet>
21+
<includes>
22+
<include>de.doubleslash:keeptime</include>
23+
</includes>
24+
</dependencySet>
25+
</dependencySets>
26+
</assembly>

keeptime.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
start "" "javaw" -Dprism.order=sw -jar keeptime-v1.0.0.jar
1+
start "" "javaw" -Dprism.order=sw -jar keeptime-1.1.0-SNAPSHOT.jar

pom.xml

Lines changed: 75 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,37 @@
55

66
<groupId>de.doubleslash</groupId>
77
<artifactId>keeptime</artifactId>
8-
<version>1.0.0-SNAPSHOT</version>
8+
<version>1.1.0-SNAPSHOT</version>
99
<packaging>jar</packaging>
1010

1111
<name>KeepTime</name>
1212
<description>Time tracker</description>
1313

14+
<licenses>
15+
<license>
16+
<name>GNU General Public License (GPL) version 3.0</name>
17+
<url>http://www.gnu.org/licenses/gpl.txt</url>
18+
<distribution>manual</distribution>
19+
</license>
20+
</licenses>
21+
22+
<organization>
23+
<name>doubleSlash Net-Business GmbH</name>
24+
<url>https://www.doubleslash.de/</url>
25+
</organization>
26+
1427
<parent>
1528
<groupId>org.springframework.boot</groupId>
1629
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>2.0.2.RELEASE</version>
30+
<version>2.1.5.RELEASE</version>
1831
<relativePath /> <!-- lookup parent from repository -->
1932
</parent>
2033

2134
<properties>
2235
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2336
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24-
<java.version>1.8</java.version>
37+
<maven.compiler.source>1.8</maven.compiler.source>
38+
<maven.compiler.target>1.8</maven.compiler.target>
2539
</properties>
2640

2741
<dependencies>
@@ -34,20 +48,21 @@
3448
<groupId>com.h2database</groupId>
3549
<artifactId>h2</artifactId>
3650
<scope>runtime</scope>
51+
<!-- overwriting managed version as newer version is not supported by flyway: H2 1.4.199 is newer than this version
52+
of Flyway and support has not been tested. -->
53+
<version>1.4.197</version>
3754
</dependency>
3855
<dependency>
3956
<groupId>org.springframework.boot</groupId>
4057
<artifactId>spring-boot-starter-test</artifactId>
4158
<scope>test</scope>
4259
</dependency>
43-
<!-- https://mvnrepository.com/artifact/org.flywaydb/flyway-maven-plugin -->
60+
4461
<dependency>
4562
<groupId>org.flywaydb</groupId>
46-
<artifactId>flyway-maven-plugin</artifactId>
47-
<version>5.1.4</version>
63+
<artifactId>flyway-core</artifactId>
4864
</dependency>
4965

50-
5166
<dependency>
5267
<groupId>com.1stleg</groupId>
5368
<artifactId>jnativehook</artifactId>
@@ -58,17 +73,18 @@
5873
<artifactId>dom</artifactId>
5974
<version>2.3.0-jaxb-1.0.6</version>
6075
</dependency>
61-
<dependency>
62-
<groupId>org.mockito</groupId>
63-
<artifactId>mockito-core</artifactId>
64-
<version>2.21.0</version>
65-
</dependency>
6676
<dependency>
6777
<groupId>org.apache.commons</groupId>
6878
<artifactId>commons-lang3</artifactId>
69-
<version>3.8</version>
7079
</dependency>
7180

81+
<!-- maven assembly plugin -->
82+
<dependency>
83+
<groupId>org.apache.maven.plugins</groupId>
84+
<artifactId>maven-assembly-plugin</artifactId>
85+
<version>3.1.1</version>
86+
<type>maven-plugin</type>
87+
</dependency>
7288
</dependencies>
7389

7490
<build>
@@ -77,8 +93,54 @@
7793
<groupId>org.springframework.boot</groupId>
7894
<artifactId>spring-boot-maven-plugin</artifactId>
7995
</plugin>
96+
97+
<plugin>
98+
<artifactId>maven-assembly-plugin</artifactId>
99+
<executions>
100+
<execution>
101+
<id>create-keeptime-zip</id>
102+
<phase>package</phase>
103+
<goals>
104+
<goal>single</goal>
105+
</goals>
106+
<configuration>
107+
<descriptors>
108+
<descriptor>./assembly.xml</descriptor>
109+
</descriptors>
110+
<finalName>keeptime-${project.version}</finalName>
111+
</configuration>
112+
</execution>
113+
</executions>
114+
</plugin>
80115
</plugins>
81116
</build>
82117

118+
<reporting>
119+
<plugins>
120+
<!-- needed for mvn site - see https://stackoverflow.com/a/51099913 -->
121+
<plugin>
122+
<groupId>org.apache.maven.plugins</groupId>
123+
<artifactId>maven-site-plugin</artifactId>
124+
<version>3.7.1</version>
125+
</plugin>
83126

127+
<plugin>
128+
<groupId>org.owasp</groupId>
129+
<artifactId>dependency-check-maven</artifactId>
130+
<version>5.0.0-M2</version>
131+
<reportSets>
132+
<reportSet>
133+
<reports>
134+
<report>aggregate</report>
135+
</reports>
136+
</reportSet>
137+
</reportSets>
138+
<configuration>
139+
<failBuildOnAnyVulnerability>true</failBuildOnAnyVulnerability>
140+
<failBuildOnCVSS>8</failBuildOnCVSS>
141+
<!-- <suppressionFile>dependency-check-report_suppressions.xml</suppressionFile> -->
142+
</configuration>
143+
</plugin>
144+
</plugins>
145+
</reporting>
84146
</project>

src/main/java/de/doubleslash/keeptime/DefaultExceptionHandler.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
// Copyright 2019 doubleSlash Net Business GmbH
2+
//
3+
// This file is part of KeepTime.
4+
// KeepTime is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
117
package de.doubleslash.keeptime;
218

319
import java.lang.Thread.UncaughtExceptionHandler;

src/main/java/de/doubleslash/keeptime/Main.java

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
// Copyright 2019 doubleSlash Net Business GmbH
2+
//
3+
// This file is part of KeepTime.
4+
// KeepTime is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
117
package de.doubleslash.keeptime;
218

319
import java.io.IOException;
@@ -14,6 +30,7 @@
1430
import org.springframework.boot.autoconfigure.SpringBootApplication;
1531
import org.springframework.context.ConfigurableApplicationContext;
1632

33+
import de.doubleslash.keeptime.common.FontProvider;
1734
import de.doubleslash.keeptime.common.Resources;
1835
import de.doubleslash.keeptime.common.Resources.RESOURCE;
1936
import de.doubleslash.keeptime.controller.Controller;
@@ -22,8 +39,8 @@
2239
import de.doubleslash.keeptime.model.Settings;
2340
import de.doubleslash.keeptime.model.Work;
2441
import de.doubleslash.keeptime.view.ViewController;
25-
import de.doubleslash.keeptime.viewPopup.GlobalScreenListener;
26-
import de.doubleslash.keeptime.viewPopup.ViewControllerPopup;
42+
import de.doubleslash.keeptime.viewpopup.GlobalScreenListener;
43+
import de.doubleslash.keeptime.viewpopup.ViewControllerPopup;
2744
import javafx.application.Application;
2845
import javafx.event.EventHandler;
2946
import javafx.fxml.FXMLLoader;
@@ -46,7 +63,7 @@ public class Main extends Application {
4663

4764
private static final Logger LOG = LoggerFactory.getLogger(Main.class);
4865

49-
public static final String VERSION = "v1.0.0";
66+
public static final String VERSION = "v1.1.0";
5067

5168
private ConfigurableApplicationContext springContext;
5269

@@ -75,7 +92,7 @@ public void init() throws Exception {
7592
public void start(final Stage primaryStage) {
7693
LOG.info("Initialising the UI");
7794
try {
78-
initUI(primaryStage);
95+
initialiseApplication(primaryStage);
7996
LOG.info("UI successfully initialised.");
8097
} catch (final Exception e) {
8198
LOG.error("There was an error while initialising the UI", e);
@@ -112,35 +129,35 @@ public void start(final Stage primaryStage) {
112129
}
113130
}
114131

115-
private void initUI(final Stage primaryStage) throws Exception {
116-
132+
private void initialiseApplication(final Stage primaryStage) throws Exception {
133+
FontProvider.loadFonts();
117134
readSettings();
118135

119-
final List<Work> todaysWorkItems = model.workRepository.findByCreationDate(LocalDate.now());
136+
final List<Work> todaysWorkItems = model.getWorkRepository().findByCreationDate(LocalDate.now());
120137
LOG.info("Found {} past work items", todaysWorkItems.size());
121-
model.pastWorkItems.addAll(todaysWorkItems);
138+
model.getPastWorkItems().addAll(todaysWorkItems);
122139

123-
final List<Project> projects = model.projectRepository.findAll();
140+
final List<Project> projects = model.getProjectRepository().findAll();
124141

125142
LOG.debug("Found '{}' projects", projects.size());
126143
if (projects.isEmpty()) {
127144
LOG.info("Adding default project");
128-
projects.add(model.DEFAULT_PROJECT);
129-
model.projectRepository.save(model.DEFAULT_PROJECT);
145+
projects.add(Model.DEFAULT_PROJECT);
146+
model.getProjectRepository().save(Model.DEFAULT_PROJECT);
130147
}
131148

132-
model.allProjects.addAll(projects);
133-
model.availableProjects
134-
.addAll(model.allProjects.stream().filter(Project::isEnabled).collect(Collectors.toList()));
149+
model.getAllProjects().addAll(projects);
150+
model.getAvailableProjects()
151+
.addAll(model.getAllProjects().stream().filter(Project::isEnabled).collect(Collectors.toList()));
135152

136153
// set default project
137154
final Optional<Project> findAny = projects.stream().filter(Project::isDefault).findAny();
138155
if (findAny.isPresent()) {
139-
model.idleProject = findAny.get();
140-
LOG.debug("Using project '{}' as default project.", model.idleProject);
156+
model.setIdleProject(findAny.get());
157+
LOG.debug("Using project '{}' as default project.", model.getIdleProject());
141158
}
142159

143-
primaryStage.setOnHiding((we) -> {
160+
primaryStage.setOnHiding(we -> {
144161
popupViewStage.close();
145162
globalScreenListener.shutdown(); // deregister, as this will keep app running
146163
});
@@ -152,21 +169,21 @@ private void initUI(final Stage primaryStage) throws Exception {
152169
private void readSettings() {
153170
LOG.debug("Reading configuration");
154171

155-
final List<Settings> settingsList = model.settingsRepository.findAll();
172+
final List<Settings> settingsList = model.getSettingsRepository().findAll();
156173
final Settings settings;
157174
if (settingsList.isEmpty()) {
158175
settings = new Settings();
159176
settings.setTaskBarColor(model.taskBarColor.get());
160177

161-
settings.setDefaultBackgroundColor(model.defaultBackgroundColor.get());
162-
settings.setDefaultFontColor(model.defaultFontColor.get());
178+
settings.setDefaultBackgroundColor(Model.ORIGINAL_DEFAULT_BACKGROUND_COLOR);
179+
settings.setDefaultFontColor(Model.ORIGINAL_DEFAULT_FONT_COLOR);
163180

164-
settings.setHoverBackgroundColor(model.hoverBackgroundColor.get());
165-
settings.setHoverFontColor(model.hoverFontColor.get());
181+
settings.setHoverBackgroundColor(Model.ORIGINAL_HOVER_BACKGROUND_COLOR);
182+
settings.setHoverFontColor(Model.ORIGINAL_HOVER_Font_COLOR);
166183
settings.setUseHotkey(false);
167184
settings.setDisplayProjectsRight(false);
168-
settings.setHideProjectsOnMouseExit(true);
169-
model.settingsRepository.save(settings);
185+
settings.setHideProjectsOnMouseExit(false);
186+
model.getSettingsRepository().save(settings);
170187
} else {
171188
settings = settingsList.get(0);
172189
}
@@ -185,10 +202,8 @@ private void initialisePopupUI(final Stage primaryStage) throws IOException {
185202
LOG.debug("Initialising popup UI.");
186203

187204
globalScreenListener = new GlobalScreenListener();
188-
// stop and close stage when main stage is shutdown
189-
model.useHotkey.addListener((a, b, newValue) -> {
190-
globalScreenListener.register(newValue);
191-
});
205+
206+
model.useHotkey.addListener((a, b, newValue) -> globalScreenListener.register(newValue));
192207
globalScreenListener.register(model.useHotkey.get());
193208

194209
popupViewStage = new Stage();
@@ -206,8 +221,8 @@ private void initialisePopupUI(final Stage primaryStage) throws IOException {
206221
// Give the controller access to the main app.
207222
popupViewStage.setAlwaysOnTop(true);
208223
final ViewControllerPopup viewControllerPopupController = loader.getController();
209-
viewControllerPopupController.setStage(popupViewStage, popupScene);
210-
viewControllerPopupController.setController(controller, model);
224+
viewControllerPopupController.setStage(popupViewStage);
225+
viewControllerPopupController.setControllerAndModel(controller, model);
211226
globalScreenListener.setViewController(viewControllerPopupController);
212227
}
213228

@@ -237,13 +252,12 @@ public void handle(final WindowEvent event) {
237252
LOG.info("On close request");
238253
}
239254
});
240-
255+
primaryStage.show();
241256
viewController = loader.getController();
242257
// Give the controller access to the main app.
243258
viewController.setStage(primaryStage);
244259
viewController.setController(controller, model);
245260

246-
primaryStage.show();
247261
}
248262

249263
@Override

0 commit comments

Comments
 (0)