public void onDateSelect(SelectEvent selectEvent) {
    Date event = (Date) selectEvent.getObject();
    Schedule schedule = (Schedule) selectEvent.getComponent();

    final TimeZone timeZone = schedule.calculateTimeZone();
    System.out.println(
        event
            + ": is in DaylightTime:"
            + timeZone.inDaylightTime(event)
            + ", getDSTSavings: "
            + timeZone.getDSTSavings());
    Calendar startDate = new GregorianCalendar();
    startDate.setTime(event);
    if (timeZone.inDaylightTime(event)) {
      startDate.add(Calendar.MILLISECOND, timeZone.getDSTSavings() * -1);
      event = startDate.getTime();
    }

    System.out.println("event start: " + event);
    Date now = new Date();
    startDate.setTime(now);
    startDate.add(Calendar.SECOND, 10);
    Trigger trigger =
        newTrigger().withIdentity("eventName", "eventGroup").startAt(startDate.getTime()).build();
    JobDetail job =
        newJob(MailJobJoinedToDeliveryDate.class)
            .withIdentity("deliverydate.isnull{" + startDate.getTime() + "}", "group-name")
            .build();
    try {
      scheduler.scheduleJob(job, trigger);
    } catch (SchedulerException e) {
      e.printStackTrace();
    }

    Calendar endDate = new GregorianCalendar();
    endDate.setTime(startDate.getTime());
    endDate.add(Calendar.HOUR, 1);

    BaseScheduleEvent scevent = new BaseScheduleEvent();
    scevent.setStartDate(startDate.getTime());
    scevent.setEndDate(endDate.getTime());
    scevent.setId("1");
    scevent.setTitle("teszt");
    eventModel.addEvent(scevent);
  }
示例#2
0
 public Agenda() {
   this.setStyle("overflow: auto;display: block;");
   // this.setWidth("100%");
   scm_modelo = new DefaultScheduleModel();
   scm_modelo.addEvent(
       new DefaultScheduleEvent("Champions League Match", previousDay8Pm(), previousDay11Pm()));
   scm_modelo.addEvent(new DefaultScheduleEvent("Birthday Party", today1Pm(), today6Pm()));
   sch_agenda.setValue(scm_modelo);
   this.getChildren().add(sch_agenda);
 }