Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ public Work saveCurrentWork(final LocalDateTime workEnd) {
}

currentWork.setEndTime(workEnd);
if (currentWork.getNotes().isEmpty()) {
currentWork.setNotes("- No notes -");
}

final String time = DateFormatter
.secondsToHHMMSS(Duration.between(currentWork.getStartTime(), currentWork.getEndTime()).getSeconds());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package de.doubleslash.keeptime.view;

import static de.doubleslash.keeptime.view.ReportController.EMPTY_NOTE;
import static de.doubleslash.keeptime.view.ReportController.NOTE_DELIMETER;

import java.lang.invoke.MethodHandles;
Expand All @@ -42,7 +41,7 @@ public ProjectReport(final int size) {

public void appendToWorkNotes(final String currentWorkNote) {
this.numberOfNotes++;
if (!currentWorkNote.equals(EMPTY_NOTE)) {
if (!currentWorkNote.isEmpty()) {
if (this.numberOfNotes > 1) {
this.sb.append(NOTE_DELIMETER);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ protected void updateItem(final TableRow item, final boolean empty) {
setGraphic(null);
setText(null);
} else {
final Text text = new Text(item.getNotes());
final String notes = item.getNotes();
final Text text = new Text(notes.isEmpty() ? EMPTY_NOTE : notes);
text.wrappingWidthProperty().bind(noteColumn.widthProperty().subtract(35));
text.setUnderline(item.isUnderlined());
this.setGraphic(text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class ProjectReportTest {
/** The slf4j-logger for this class. */
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

private static final String EMPTY_NOTE = "";

private ProjectReport uut;

@Before
Expand All @@ -40,7 +42,7 @@ public void setUp() throws Exception {
@Test
public void testAppendToWorkNotes() {
this.uut.appendToWorkNotes("note 1 ");
this.uut.appendToWorkNotes(ReportController.EMPTY_NOTE);
this.uut.appendToWorkNotes(EMPTY_NOTE);
this.uut.appendToWorkNotes("note 2 ");
final String expected = "note 1; note 2";
assertEquals(expected, this.uut.getNotes(false));
Expand All @@ -49,7 +51,7 @@ public void testAppendToWorkNotes() {
@Test
public void testAppendToWorkNotesAddNumberOfNotes() {
this.uut.appendToWorkNotes("note 1 ");
this.uut.appendToWorkNotes(ReportController.EMPTY_NOTE);
this.uut.appendToWorkNotes(EMPTY_NOTE);
this.uut.appendToWorkNotes("note 2 ");
final String expected = "3 Notes: note 1; note 2";
assertEquals(expected, this.uut.getNotes(true));
Expand All @@ -70,8 +72,8 @@ public void testAppendToWorkNotesAddNumberOfNotes_EmptyNotesAtTheEnd() {
this.uut = new ProjectReport(4);
this.uut.appendToWorkNotes("note 1");
this.uut.appendToWorkNotes("note 2");
this.uut.appendToWorkNotes(ReportController.EMPTY_NOTE);
this.uut.appendToWorkNotes(ReportController.EMPTY_NOTE);
this.uut.appendToWorkNotes(EMPTY_NOTE);
this.uut.appendToWorkNotes(EMPTY_NOTE);
final String expected = "4 Notes: note 1; note 2";
assertEquals(expected, this.uut.getNotes(true));
}
Expand Down