2626import de .doubleslash .keeptime .rest .integration .heimat .model .HeimatTask ;
2727import de .doubleslash .keeptime .rest .integration .heimat .model .HeimatTime ;
2828import de .doubleslash .keeptime .view .ProjectReport ;
29- import javafx .scene .text .Text ;
30- import javafx .scene .text .TextFlow ;
3129import org .slf4j .Logger ;
3230import org .slf4j .LoggerFactory ;
3331import org .springframework .beans .factory .annotation .Autowired ;
@@ -147,19 +145,20 @@ public List<Mapping> getTableRows(final LocalDate currentReportDate, final List<
147145 pr .appendToWorkNotes (currentWorkNote );
148146 }
149147 final String keeptimeNotes = pr .getNotes ();
150- TextFlow canBeSyncedMessage ;
148+ StyledMessage canBeSyncedMessage ;
151149
152150 if (!isMappedInHeimat ) {
153- canBeSyncedMessage = new TextFlow (new Text ("Not mapped to Heimat task.\n Map in settings dialog." ));
151+ canBeSyncedMessage = StyledMessage .of (
152+ new StyledMessage .TextSegment ("Not mapped to Heimat task.\n Map in settings dialog." ));
154153 } else if (heimatTasks .stream ().noneMatch (ht -> ht .id () == optHeimatMapping .get ().getExternalTaskId ())) {
155- canBeSyncedMessage = new TextFlow (new Text ("Heimat Task is not available (anymore).\n Please check mappings in settings dialog." ));
154+ canBeSyncedMessage = StyledMessage .of (new StyledMessage .TextSegment (
155+ "Heimat Task is not available (anymore).\n Please check mappings in settings dialog." ));
156156 isMappedInHeimat = false ;
157157 } else {
158158 final ExternalProjectMapping externalProjectMapping = optHeimatMapping .get ();
159- Text externalTaskName = new Text (externalProjectMapping .getExternalTaskName ());
160- externalTaskName .setStyle ("-fx-font-weight: bold;" );
161- canBeSyncedMessage = new TextFlow (new Text ("Sync to " ), externalTaskName ,
162- new Text ("\n (" + externalProjectMapping .getExternalProjectName () + ")" ));
159+ canBeSyncedMessage = StyledMessage .of (new StyledMessage .TextSegment ("Sync to " ),
160+ new StyledMessage .TextSegment (externalProjectMapping .getExternalTaskName (), true ),
161+ new StyledMessage .TextSegment ("\n (" + externalProjectMapping .getExternalProjectName () + ")" ));
163162 }
164163
165164 final String bookingHint = heimatTasks .stream ()
@@ -168,7 +167,6 @@ public List<Mapping> getTableRows(final LocalDate currentReportDate, final List<
168167 .findAny ()
169168 .orElseGet (String ::new );
170169
171-
172170 if (optionalExistingMapping .isPresent ()) {
173171 final Mapping existingMapping = optionalExistingMapping .get ();
174172 final ArrayList <Project > projects = new ArrayList <>(existingMapping .projects ());
@@ -178,18 +176,18 @@ public List<Mapping> getTableRows(final LocalDate currentReportDate, final List<
178176 final boolean shouldBeSynced =
179177 isMappedInHeimat && differenceGreaterOrEqual15Minutes (heimatSeconds , keepTimeSeconds );
180178 final Mapping mapping = new Mapping (isMappedInHeimat ? optHeimatMapping .get ().getExternalTaskId () : -1 ,
181- isMappedInHeimat , shouldBeSynced , canBeSyncedMessage , bookingHint , existingMapping .existingTimes (), projects ,
182- existingMapping .heimatNotes (), existingMapping .keeptimeNotes () + ". " + keeptimeNotes , heimatSeconds ,
183- keepTimeSeconds );
179+ isMappedInHeimat , shouldBeSynced , canBeSyncedMessage , bookingHint , existingMapping .existingTimes (),
180+ projects , existingMapping .heimatNotes (), existingMapping .keeptimeNotes () + ". " + keeptimeNotes ,
181+ heimatSeconds , keepTimeSeconds );
184182 list .remove (existingMapping );
185183 list .add (mapping );
186184 } else {
187185 final boolean shouldBeSynced =
188186 isMappedInHeimat && differenceGreaterOrEqual15Minutes (heimatTimeSeconds , projectWorkSeconds );
189187 final List <Project > projects = Collections .singletonList (project );
190188 final Mapping mapping = new Mapping (isMappedInHeimat ? optHeimatMapping .get ().getExternalTaskId () : -1 ,
191- isMappedInHeimat , shouldBeSynced , canBeSyncedMessage , bookingHint , optionalAlreadyBookedTimes , projects ,
192- heimatNotes , keeptimeNotes , heimatTimeSeconds , projectWorkSeconds );
189+ isMappedInHeimat , shouldBeSynced , canBeSyncedMessage , bookingHint , optionalAlreadyBookedTimes ,
190+ projects , heimatNotes , keeptimeNotes , heimatTimeSeconds , projectWorkSeconds );
193191 list .add (mapping );
194192 }
195193 }
@@ -209,8 +207,8 @@ public List<Mapping> getTableRows(final LocalDate currentReportDate, final List<
209207 .filter (t -> t .id () == times .get (0 ).taskId ())
210208 .findAny ()
211209 .orElseThrow ();
212- final Mapping mapping = new Mapping (id , true , false ,
213- new TextFlow ( new Text ( "Not mapped in KeepTime\n \n " + heimatTask .name () + "\n " + heimatTask .taskHolderName ())), "" , times ,
210+ final Mapping mapping = new Mapping (id , true , false , StyledMessage . of ( new StyledMessage . TextSegment (
211+ "Not mapped in KeepTime\n \n " + heimatTask .name () + "\n " + heimatTask .taskHolderName ())), "" , times ,
214212 new ArrayList <>(0 ), heimatNotes , "" , heimatTimeSeconds , 0 );
215213 list .add (mapping );
216214 });
@@ -233,18 +231,17 @@ public List<Mapping> getTableRows(final LocalDate currentReportDate, final List<
233231 String heimatNotes = addHeimatNotes (times );
234232 long heimatTimeSeconds = addHeimatTimes (times );
235233
236- Text externalTaskName = new Text (externalProjectMapping .getExternalTaskName ());
237- externalTaskName .setStyle ("-fx-font-weight: bold;" );
238- TextFlow syncMessage = new TextFlow (new Text ("Present in HEIMAT but not KeepTime\n \n Sync to " ), externalTaskName ,
239- new Text ("\n (" + externalProjectMapping .getExternalProjectName () + ")" ));
240-
241- final Mapping mapping2 = new Mapping (id , true , false ,
242- syncMessage , "" , times , mappedProjects .stream ()
243- .filter (
244- mp -> mp .getExternalTaskId ()
245- == id )
246- .map (ExternalProjectMapping ::getProject )
247- .toList (),
234+ StyledMessage syncMessage = StyledMessage .of (
235+ new StyledMessage .TextSegment ("Present in HEIMAT but not KeepTime\n \n Sync to " ),
236+ new StyledMessage .TextSegment (externalProjectMapping .getExternalTaskName (), true ),
237+ new StyledMessage .TextSegment ("\n (" + externalProjectMapping .getExternalProjectName () + ")" ));
238+
239+ final Mapping mapping2 = new Mapping (id , true , false , syncMessage , "" , times , mappedProjects .stream ()
240+ .filter (
241+ mp -> mp .getExternalTaskId ()
242+ == id )
243+ .map (ExternalProjectMapping ::getProject )
244+ .toList (),
248245 heimatNotes , "" , heimatTimeSeconds , 0 );
249246 list .add (mapping2 );
250247 });
@@ -437,8 +434,8 @@ public ExistingAndInvalidMappings getExistingProjectMappings(List<HeimatTask> ex
437434
438435 public record UserMapping (Mapping mapping , boolean shouldSync , String userNotes , int userMinutes ) {}
439436
440- public record Mapping (long heimatTaskId , boolean canBeSynced , boolean shouldBeSynced , TextFlow syncMessage , String bookingHint ,
441- List <HeimatTime > existingTimes , List <Project > projects , String heimatNotes ,
437+ public record Mapping (long heimatTaskId , boolean canBeSynced , boolean shouldBeSynced , StyledMessage syncMessage ,
438+ String bookingHint , List <HeimatTime > existingTimes , List <Project > projects , String heimatNotes ,
442439 String keeptimeNotes , long heimatSeconds , long keeptimeSeconds ) {}
443440
444441 public record HeimatErrors (UserMapping mapping , String errorMessage ) {}
0 commit comments