Search in sources :

Example 1 with AppointmentImplLocal

use of jfxtras.scene.control.agenda.Agenda.AppointmentImplLocal in project phoebus by ControlSystemStudio.

the class LogEntryCalenderViewController method refresh.

private void refresh() {
    map = new HashMap<Appointment, LogEntry>();
    map = this.logEntries.stream().collect(Collectors.toMap(new Function<LogEntry, Appointment>() {

        @Override
        public Appointment apply(LogEntry logentry) {
            AppointmentImplLocal appointment = new Agenda.AppointmentImplLocal();
            appointment.withSummary(logentry.getDescription());
            appointment.withDescription(logentry.getDescription());
            appointment.withStartLocalDateTime(LocalDateTime.ofInstant(logentry.getCreatedDate(), ZoneId.systemDefault()));
            appointment.withEndLocalDateTime(LocalDateTime.ofInstant(logentry.getCreatedDate().plusSeconds(2400), ZoneId.systemDefault()));
            List<String> logbookNames = getLogbookNames();
            if (logbookNames != null && !logbookNames.isEmpty()) {
                int index = logbookNames.indexOf(logentry.getLogbooks().iterator().next().getName());
                if (index >= 0 && index <= 22) {
                    appointment.setAppointmentGroup(appointmentGroupMap.get(String.format("group%02d", (index + 1))));
                } else {
                    appointment.setAppointmentGroup(appointmentGroupMap.get(String.format("group%02d", 23)));
                }
            }
            return appointment;
        }
    }, new Function<LogEntry, LogEntry>() {

        @Override
        public LogEntry apply(LogEntry logentry) {
            return logentry;
        }
    }));
    agenda.appointments().clear();
    agenda.appointments().setAll(map.keySet());
}
Also used : Appointment(jfxtras.scene.control.agenda.Agenda.Appointment) AppointmentImplLocal(jfxtras.scene.control.agenda.Agenda.AppointmentImplLocal) AppointmentImplLocal(jfxtras.scene.control.agenda.Agenda.AppointmentImplLocal) Agenda(jfxtras.scene.control.agenda.Agenda) List(java.util.List) LogEntry(org.phoebus.logbook.LogEntry)

Example 2 with AppointmentImplLocal

use of jfxtras.scene.control.agenda.Agenda.AppointmentImplLocal in project phoebus by ControlSystemStudio.

the class LogEntryCalenderViewController method refresh.

private void refresh() {
    map = new HashMap<Appointment, LogEntry>();
    map = this.logEntries.stream().collect(Collectors.toMap(new Function<LogEntry, Appointment>() {

        @Override
        public Appointment apply(LogEntry logentry) {
            AppointmentImplLocal appointment = new Agenda.AppointmentImplLocal();
            appointment.withSummary(logentry.getDescription());
            appointment.withDescription(logentry.getDescription());
            appointment.withStartLocalDateTime(LocalDateTime.ofInstant(logentry.getCreatedDate(), ZoneId.systemDefault()));
            appointment.withEndLocalDateTime(LocalDateTime.ofInstant(logentry.getCreatedDate().plusSeconds(2400), ZoneId.systemDefault()));
            List<String> logbookNames = getLogbookNames();
            if (logbookNames != null && !logbookNames.isEmpty()) {
                int index = logbookNames.indexOf(logentry.getLogbooks().iterator().next().getName());
                if (index >= 0 && index <= 22) {
                    appointment.setAppointmentGroup(appointmentGroupMap.get(String.format("group%02d", (index + 1))));
                } else {
                    appointment.setAppointmentGroup(appointmentGroupMap.get(String.format("group%02d", 23)));
                }
            }
            return appointment;
        }
    }, new Function<LogEntry, LogEntry>() {

        @Override
        public LogEntry apply(LogEntry logentry) {
            return logentry;
        }
    }));
    Platform.runLater(() -> {
        agenda.appointments().clear();
        agenda.appointments().setAll(map.keySet());
    });
}
Also used : Appointment(jfxtras.scene.control.agenda.Agenda.Appointment) AppointmentImplLocal(jfxtras.scene.control.agenda.Agenda.AppointmentImplLocal) AppointmentImplLocal(jfxtras.scene.control.agenda.Agenda.AppointmentImplLocal) Agenda(jfxtras.scene.control.agenda.Agenda) List(java.util.List) ObservableList(javafx.collections.ObservableList) LogEntry(org.phoebus.logbook.LogEntry)

Aggregations

List (java.util.List)2 Agenda (jfxtras.scene.control.agenda.Agenda)2 Appointment (jfxtras.scene.control.agenda.Agenda.Appointment)2 AppointmentImplLocal (jfxtras.scene.control.agenda.Agenda.AppointmentImplLocal)2 LogEntry (org.phoebus.logbook.LogEntry)2 ObservableList (javafx.collections.ObservableList)1