Search in sources :

Example 1 with LocalDateTimeRange

use of jfxtras.scene.control.agenda.Agenda.LocalDateTimeRange in project Gargoyle by callakrsos.

the class AgendaExam method start.

/* (non-Javadoc)
	 * @see javafx.application.Application#start(javafx.stage.Stage)
	 */
@Override
public void start(Stage primaryStage) throws Exception {
    Agenda agenda = new Agenda() {

        @Override
        public Skin<?> createDefaultSkin() {
            return new AgendaDaysFromDisplayedSkin(this);
        }
    };
    // setup appointment groups
    final Map<String, Agenda.AppointmentGroup> lAppointmentGroupMap = new TreeMap<String, Agenda.AppointmentGroup>();
    for (Agenda.AppointmentGroup lAppointmentGroup : agenda.appointmentGroups()) {
        lAppointmentGroupMap.put(lAppointmentGroup.getDescription(), lAppointmentGroup);
    }
    // accept new appointments
    agenda.newAppointmentCallbackProperty().set(new Callback<Agenda.LocalDateTimeRange, Agenda.Appointment>() {

        @Override
        public Agenda.Appointment call(LocalDateTimeRange dateTimeRange) {
            return new Agenda.AppointmentImplLocal().withStartLocalDateTime(dateTimeRange.getStartLocalDateTime()).withEndLocalDateTime(dateTimeRange.getEndLocalDateTime()).withSummary("new").withDescription("new").withAppointmentGroup(lAppointmentGroupMap.get("group01"));
        }
    });
    BorderPane root = new BorderPane(agenda);
    root.getStylesheets().add(AgendaSkinSwitcher.class.getResource("/jfxtras/internal/scene/control/skin/agenda/" + AgendaSkinSwitcher.class.getSimpleName() + ".css").toExternalForm());
    primaryStage.setScene(new Scene(root));
    primaryStage.show();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) AgendaDaysFromDisplayedSkin(jfxtras.internal.scene.control.skin.agenda.AgendaDaysFromDisplayedSkin) Agenda(jfxtras.scene.control.agenda.Agenda) TreeMap(java.util.TreeMap) Scene(javafx.scene.Scene) AgendaSkinSwitcher(jfxtras.scene.control.agenda.AgendaSkinSwitcher) LocalDateTimeRange(jfxtras.scene.control.agenda.Agenda.LocalDateTimeRange)

Aggregations

TreeMap (java.util.TreeMap)1 Scene (javafx.scene.Scene)1 BorderPane (javafx.scene.layout.BorderPane)1 AgendaDaysFromDisplayedSkin (jfxtras.internal.scene.control.skin.agenda.AgendaDaysFromDisplayedSkin)1 Agenda (jfxtras.scene.control.agenda.Agenda)1 LocalDateTimeRange (jfxtras.scene.control.agenda.Agenda.LocalDateTimeRange)1 AgendaSkinSwitcher (jfxtras.scene.control.agenda.AgendaSkinSwitcher)1