How to list dates from database onto JFXtras Agend

2019-09-01 09:10发布

I have event dates, titles, venues, attendees, start & end times, location and other metadata collected from users via forms then stored in a mysql database table. I would like to retrieve the events from the database and list them in Google Calender style. So far I only know of JFXtras Agenda having this kind of implementation.

I've been trying for a long time now to work with JFXtras Agenda but I'm stuck at retrieving the events from the database and listing them on the Agenda as Appointments.

How do I go about it? I'm ready to try out any other implementation that lists events from data base like Google Calender does.

Thank you in advance.

Ps.

I think my problem is that I don't understand what an appointment group is from AppointmentGroup Interface (Class Agenda.AppointmentImpl) is supposed to do/ what it is....

From the API: ".......An appointment group is a binding element between appointments; it contains information about visualization....."

What does "binding element between appointments" mean?

1条回答
等我变得足够好
2楼-- · 2019-09-01 09:56

1) Create custom model

public class Event {

    GregorianCalendar startTime;
    GregorianCalendar endTime;
    ...

    public GregorianCalendar getStartTime() {
        return startTime;
    }

    public void setStartTime(GregorianCalendar startTime) {
        this.startTime = startTime;
    }

    public GregorianCalendar getEndTime() {
        return endTime;
    }

    public void setEndTime(GregorianCalendar endTime) {
        this.endTime = endTime;
    }
    ...
}

2) Retrive events from database to List<Event> myEvents

3) Fill your Agenda

Agenda lAgenda = new Agenda();
...
for (Event e : myEvents) {
    lAgenda.appointments().add(
        new Agenda.AppointmentImpl()
        .withStartTime(e.getStartTime())
        .withEndTime(e.getEndTime()));
        ...
}
查看更多
登录 后发表回答