コード例 #1
0
ファイル: CalendarMainCtrl.java プロジェクト: bungbil/smas
  /**
   * If the onEventUpdate event is called. <br>
   * Handles the resizing or movement of an calendarEvent. Saves the new data to db.
   *
   * @param event
   */
  public void onEventUpdate$cal(CalendarsEvent evt) {

    // SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/d");
    // sdf1.setTimeZone(cal.getDefaultTimeZone());

    int left = evt.getX();
    int top = evt.getY();
    if (top + 100 > evt.getDesktopHeight()) top = evt.getDesktopHeight() - 100;
    if (left + 330 > evt.getDesktopWidth()) left = evt.getDesktopWidth() - 330;

    SimpleCalendarModel m = (SimpleCalendarModel) cal.getModel();
    MySimpleCalendarEvent sce = (MySimpleCalendarEvent) evt.getCalendarEvent();
    sce.setBeginDate(evt.getBeginDate());
    sce.setEndDate(evt.getEndDate());
    // update the model
    // m.update(sce); <-- if activated, later an error occurs

    // prepare the backend Bean
    MyCalendarEvent calEvt = getCalendarEventService().getNewCalendarEvent();
    calEvt.setId(sce.getId());
    calEvt.setSecUser(sce.getUser());
    calEvt.setVersion(sce.getVersion());
    calEvt.setTitle(sce.getTitle());
    calEvt.setContent(sce.getContent());
    calEvt.setBeginDate(sce.getBeginDate());
    calEvt.setEndDate(sce.getEndDate());
    calEvt.setHeaderColor(sce.getHeaderColor());
    calEvt.setContentColor(sce.getContentColor());
    // Save the calendar event to database
    try {
      getCalendarEventService().saveOrUpdate(calEvt);
    } catch (Exception e) {
      e.printStackTrace();
    }

    try {
      synchronizeModel();
    } catch (ParseException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
コード例 #2
0
 public void onEventCreate(CalendarsEvent event) throws InterruptedException, RemoteException {
   StorageComponentProxy proxy = SystemDictionary.getSCProxy();
   bookEventWin = (Window) Executions.createComponents("bookEvent.zul", self.getParent(), null);
   bookEventWin.setAttribute("calendars", cal);
   bookEventWin.setAttribute("calevent", event);
   bookEventWin.getFellow("qsrow").setVisible(true);
   Date setting = event.getBeginDate();
   setting.setTime(setting.getTime() + 43200000);
   ((Datebox) bookEventWin.getFellow("datetask")).setValue(setting);
   ((Timebox) bookEventWin.getFellow("timetask")).setValue(setting);
   ((Button) bookEventWin.getFellow("savebutton")).setVisible(true);
   ((Listbox) bookEventWin.getFellow("tasktypesel")).setSelectedIndex(0);
   String userid = (String) Sessions.getCurrent().getAttribute("userid");
   ((Textbox) bookEventWin.getFellow("userid")).setValue(userid);
   Toolbar toolbar = (Toolbar) self.getFellow("toolbar");
   String currentexecutor = ((Label) toolbar.getFellow("exechelp")).getValue();
   SystemDictionary.webguiLog("DEBUG", "Executor: " + currentexecutor);
   OperationResult opres =
       proxy.getUserIdByPersonId(currentexecutor, SystemDictionary.USERTYPE_PATIENT_INT, userid);
   Patient patient = proxy.getPatient(currentexecutor, userid);
   Carer carer = patient.getPatientCarer();
   OperationResult realexecutor =
       proxy.getUserIdByPersonId(carer.getID(), SystemDictionary.USERTYPE_CARER_INT, userid);
   SystemDictionary.webguiLog(
       "DEBUG", "Executor req: " + realexecutor.getCode() + ":" + opres.getDescription());
   ((Textbox) bookEventWin.getFellow("objid")).setValue(realexecutor.getCode());
   ((Textbox) bookEventWin.getFellow("addressedid")).setValue(opres.getCode());
   ((Textbox) bookEventWin.getFellow("objstr")).setValue(carer.toString());
   ((Textbox) bookEventWin.getFellow("addressedstr")).setValue(patient.toString());
   User assigner = proxy.getUser(userid);
   Clinician assg = proxy.getClinician(assigner.getPersonID(), userid);
   ((Textbox) bookEventWin.getFellow("userstr")).setValue(assg.toString());
   ((Listbox) bookEventWin.getFellow("questnamefield")).setSelectedIndex(0);
   // bookEventWin.getFellow("assignerrow").setVisible(false);
   bookEventWin.getFellow("massivequestionrow").setVisible(true);
   bookEventWin.getFellow("massivecheckrow").setVisible(true);
   bookEventWin.setTitle("New Task");
   bookEventWin.setVisible(true);
   bookEventWin.doModal();
 }