javafxjfxtras

jfxtras icalendaragenda how i get appointments?


Hello :) I can use in my project jfxtras ICalendar but i cant connect this project with the database.

I created a calendar, but how to download the created event or how to add to the created calendar event straight from the source code?

@Override
public void start(Stage primaryStage) throws Exception {

    VCalendar vCalendar = new VCalendar();
    ICalendarAgenda agenda = new ICalendarAgenda(vCalendar);

    BorderPane root = new BorderPane(); 

    root.setCenter(agenda);
    Scene scene = new Scene(root, 800, 600);
    primaryStage.setScene(scene); 
    primaryStage.show(); 
}

I created a new event but how to add it to the calendar?

Agenda event = new Agenda();
event.appointments().addAll(
     new Agenda.AppointmentImplLocal()
     .withStartLocalDateTime(LocalDate.now().atTime(4, 00))
     .withEndLocalDateTime(LocalDate.now().atTime(15, 30))
     .withDescription("It's time")
     .withAppointmentGroup(new Agenda.AppointmentGroupImpl().withStyleClass("group1")) 
        );

and the other way how to download the created event? I need to control it so that it can be edited.

Please help.


Solution

  • Agenda has an appointments collection where you can add the appointments it needs to render to. As described in the JavaDoc.

    http://jfxtras.org/doc/8.0/jfxtras-agenda/index.html

    The appointments collection is an observable list, so any changes to it can be detected and responded to, like saving it in a database.