2929import com .sun .javafx .scene .control .skin .DatePickerSkin ;
3030
3131import de .doubleslash .keeptime .common .DateFormatter ;
32- import de .doubleslash .keeptime .common .DateProvider ;
3332import de .doubleslash .keeptime .common .FontProvider ;
3433import de .doubleslash .keeptime .controller .Controller ;
3534import de .doubleslash .keeptime .model .Model ;
@@ -79,16 +78,14 @@ public class ReportController {
7978 private ScrollPane scrollPane ;
8079
8180 @ FXML
82- private Canvas canvas ;
81+ private Canvas colorTimeLineCanvas ;
8382
8483 private static final Logger LOG = LoggerFactory .getLogger (ReportController .class );
8584
8685 private DatePicker datePicker ; // for calendar element
8786
8887 private Model model ;
8988
90- private DateProvider dateProvider ;
91-
9289 private Controller controller ;
9390
9491 private ColorTimeLine colorTimeLine ;
@@ -103,7 +100,7 @@ private void initialize() {
103100 updateReport (newvalue );
104101 });
105102
106- colorTimeLine = new ColorTimeLine (canvas );
103+ colorTimeLine = new ColorTimeLine (colorTimeLineCanvas );
107104 }
108105
109106 private void updateReport (final LocalDate newvalue ) {
@@ -126,23 +123,23 @@ private void updateReport(final LocalDate newvalue) {
126123 for (final Project project : workedProjectsSet ) {
127124 final Label projectName = new Label (project .getName ());
128125 projectName .setFont (FontProvider .getBoldFont ());
126+ projectName .setUnderline (project .isWork ());
129127 final Circle circle = new Circle (5 , project .getColor ());
130128
131- final HBox nameHBox = new HBox ();
132- nameHBox .setAlignment (Pos .CENTER_LEFT );
133- nameHBox .setPadding (new Insets (0 , 0 , 0 , 5 ));
134- nameHBox .setSpacing (5 );
129+ final HBox projectNameHBox = new HBox ();
130+ projectNameHBox .setAlignment (Pos .CENTER_LEFT );
131+ projectNameHBox .setPadding (new Insets (0 , 0 , 0 , 5 ));
132+ projectNameHBox .setSpacing (5 );
135133
136- nameHBox .getChildren ().add (circle );
137- nameHBox .getChildren ().add (projectName );
134+ projectNameHBox .getChildren ().add (circle );
135+ projectNameHBox .getChildren ().add (projectName );
138136
139- this .gridPane .add (nameHBox , 0 , rowIndex );
137+ this .gridPane .add (projectNameHBox , 0 , rowIndex );
140138
141139 final List <Work > onlyCurrentProjectWork = currentWorkItems .stream ().filter (w -> w .getProject () == project )
142140 .collect (Collectors .toList ());
143141
144- final long todaysWorkSeconds = onlyCurrentProjectWork .stream ()
145- .mapToLong (work -> DateFormatter .getSecondsBewtween (work .getStartTime (), work .getEndTime ())).sum ();
142+ final long todaysWorkSeconds = controller .calcSeconds (onlyCurrentProjectWork );
146143
147144 currentSeconds += todaysWorkSeconds ;
148145 if (project .isWork ()) {
0 commit comments