Skip to content

Commit f40ac78

Browse files
committed
more cleanup
1 parent 188558b commit f40ac78

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ private void initialiseUI(final Stage primaryStage) throws IOException {
224224
// Show the scene containing the root layout.
225225
final Scene mainScene = new Scene(mainPane, Color.TRANSPARENT);
226226

227-
// Image(Resources.getResource(RESOURCE.ICON_MAIN).toString()));
227+
// Image(Resources.getResource(RESOURCE.ICON_MAIN).toString())); // TODO use an app icon
228228

229229
primaryStage.setTitle("KeepTime");
230230
primaryStage.setScene(mainScene);

src/main/java/de/doubleslash/keeptime/model/Model.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public Model(final ProjectRepository projectRepository, final WorkRepository wor
3838

3939
public static final Color originalTaskBarFontColor = Color.BLACK;
4040

41-
public final Project DEFAULT_PROJECT = new Project("Idle", Color.ORANGE, false, 0, true);
41+
public static final Project DEFAULT_PROJECT = new Project("Idle", Color.ORANGE, false, 0, true);
4242
public Project idleProject = DEFAULT_PROJECT;
4343

4444
public ObservableList<Project> availableProjects = FXCollections.observableArrayList();

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.HashMap;
99
import java.util.List;
1010
import java.util.Map;
11+
import java.util.Map.Entry;
1112
import java.util.Optional;
1213

1314
import org.slf4j.Logger;
@@ -423,8 +424,9 @@ private void initialize() throws IOException {
423424
allTimeLabel.setText(DateFormatter.secondsToHHMMSS(todayWorkingSeconds));
424425
todayAllSeconds.setText(DateFormatter.secondsToHHMMSS(todaySeconds));
425426

426-
for (final Project p : elapsedProjectTimeLabelMap.keySet()) {
427-
final Label label = elapsedProjectTimeLabelMap.get(p);
427+
for (final Entry<Project, Label> entry : elapsedProjectTimeLabelMap.entrySet()) {
428+
final Project p = entry.getKey();
429+
final Label label = entry.getValue();
428430

429431
final long seconds = model.pastWorkItems.stream().filter((work) -> work.getProject().getId() == p.getId())
430432
.mapToLong(work -> {
@@ -533,8 +535,6 @@ private Node addProjectToProjectList(final Project p) {
533535
final MouseButton button = a.getButton();
534536
if (button == MouseButton.PRIMARY) {
535537
changeProject(p, 0);
536-
} else if (button == MouseButton.SECONDARY) {
537-
538538
}
539539

540540
});

src/main/java/de/doubleslash/keeptime/viewPopup/ViewControllerPopup.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class ViewControllerPopup {
5050
private FilteredList<Project> filteredData;
5151

5252
private void changeProject(final Project item) {
53-
LOG.info("Change project to '" + item.getName() + "'.");
53+
LOG.info("Change project to '{}'.", item.getName());
5454

5555
// ask for a note for the current project
5656
final TextInputDialog dialog = new TextInputDialog(model.activeWorkItem.get().getNotes());
@@ -84,12 +84,10 @@ protected void updateItem(final Project project, final boolean empty) {
8484

8585
if (project == null || empty) {
8686
setText(null);
87-
// setPrefHeight(0);
8887
} else {
8988
setOnMouseClicked((ev) -> {
9089
changeProject(project);
9190
});
92-
// setPrefHeight(24);
9391
final boolean isActiveProject = project == model.activeWorkItem.get().getProject();
9492
setText((isActiveProject ? "* " : "") + project.getName());
9593
setTextFill(project.getColor());
@@ -104,7 +102,7 @@ protected void updateItem(final Project project, final boolean empty) {
104102
// TODO why is there no nice way for listview height?
105103
// https://stackoverflow.com/questions/17429508/how-do-you-get-javafx-listview-to-be-the-height-of-its-items
106104
final Consumer<Double> updateSize = (height) -> {
107-
LOG.debug("update size" + height);
105+
LOG.debug("update size {}.", height);
108106
projectListView.setPrefHeight(height);
109107
stage.sizeToScene(); // also update scene size
110108
};

0 commit comments

Comments
 (0)