How to list dates from database onto JFXtras Agenda as Appointments: Google Calender style event listing

浪尽此生 提交于 2020-01-06 08:33:26

问题


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:


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()));
        ...
}


来源:https://stackoverflow.com/questions/22660846/how-to-list-dates-from-database-onto-jfxtras-agenda-as-appointments-google-cale

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!