Skip to content

Commit 9a0ae5c

Browse files
committed
Merge branch 'develop' into feature/logo
# Conflicts: # src/main/java/de/doubleslash/keeptime/view/ViewController.java
2 parents 8512109 + fb026c3 commit 9a0ae5c

File tree

10 files changed

+570
-409
lines changed

10 files changed

+570
-409
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Contributing
2+
3+
If you want to contribute please follow this guideline.
4+
5+
## FXML files
6+
7+
For editing fxml files, use the "JavaFX Scene Builder" in version 8.5.0.
8+
Layouting is generally done with fxml files.

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ private void initialisePopupUI(final Stage primaryStage) throws IOException {
228228
final ViewControllerPopup viewControllerPopupController = loader.getController();
229229
viewControllerPopupController.setStage(popupViewStage);
230230
viewControllerPopupController.setControllerAndModel(controller, model);
231+
viewControllerPopupController.secondInitialize();
232+
231233
globalScreenListener.setViewController(viewControllerPopupController);
232234
}
233235

@@ -265,6 +267,7 @@ public void handle(final WindowEvent event) {
265267
// Give the controller access to the main app.
266268
viewController.setStage(primaryStage);
267269
viewController.setController(controller, model);
270+
viewController.secondInitialize();
268271

269272
}
270273

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package de.doubleslash.keeptime.common;
2+
3+
public class StyleUtils {
4+
5+
private StyleUtils() {
6+
7+
}
8+
9+
/**
10+
* Returns a new String representing a JavaFX style with a new given value for a given attribute.
11+
*
12+
* @param style
13+
* A String representing a JavaFX style.
14+
* @param attribute
15+
* A String representing a JavaFX style attribute.
16+
* @param newValue
17+
* A String representing the value that should be assigned to the given JavaFX style attribute.
18+
* @return A String representing the new JavaFX style.
19+
*/
20+
public static String changeStyleAttribute(final String style, final String attribute, final String newValue) {
21+
final String newStyleAttribute = "-" + attribute + ": " + newValue + "; ";
22+
if (style.contains(attribute)) {
23+
return style.replaceAll("-" + attribute + ": " + "[^;]+;", newStyleAttribute);
24+
}
25+
return style + newStyleAttribute;
26+
}
27+
28+
}

src/main/java/de/doubleslash/keeptime/controller/Controller.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ public void deleteProject(final Project p) {
142142
LOG.error("You cannot delete the default project. Tried to delete project '{}'", p);
143143
return;
144144
}
145+
146+
if (isProjectActive(p)) {
147+
changeProject(model.getIdleProject());
148+
}
149+
145150
LOG.info("Disabeling project '{}'.", p);
146151

147152
final int indexToRemove = p.getIndex();
@@ -158,6 +163,10 @@ public void deleteProject(final Project p) {
158163
model.getProjectRepository().saveAll(changedProjects);
159164
}
160165

166+
private boolean isProjectActive(final Project p) {
167+
return p == model.activeWorkItem.get().getProject();
168+
}
169+
161170
public void editProject(final Project p, final String newName, final Color newColor, final boolean isWork,
162171
final int newIndex) {
163172
LOG.info("Changing project '{}' to '{}' '{}' '{}'", p, newName, newColor, isWork);

0 commit comments

Comments
 (0)