Examples of MySimpleCalendarEvent


Examples of de.forsthaus.webui.calendar.model.MySimpleCalendarEvent

   */
  public void doSave(Event event) {

    org.zkoss.calendar.Calendars cals = getCalendarCtrl().getCal();

    MySimpleCalendarEvent ce = (MySimpleCalendarEvent) editEventWindow.getAttribute("ce");
    Calendar cal = Calendar.getInstance(cals.getDefaultTimeZone());
    Date beginDate = ppbegin.getValue();
    Date endDate = ppend.getValue();

    beginDate.setSeconds(0);
    endDate.setSeconds(0);

    if (!ppallDay.isChecked()) {
      String[] times = ppbt.getSelectedItem().getLabel().split(":");
      cal.setTime(beginDate);
      cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(times[0]));
      cal.set(Calendar.MINUTE, Integer.parseInt(times[1]));
      cal.set(Calendar.SECOND, 0);
      cal.set(Calendar.MILLISECOND, 0);
      beginDate = cal.getTime();
      times = ppet.getSelectedItem().getLabel().split(":");
      cal.setTime(endDate);
      cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(times[0]));
      cal.set(Calendar.MINUTE, Integer.parseInt(times[1]));
      cal.set(Calendar.SECOND, 0);
      cal.set(Calendar.MILLISECOND, 0);
      endDate = cal.getTime();
    } else {
      cal.setTime(beginDate);
      cal.set(Calendar.HOUR_OF_DAY, 0);
      cal.set(Calendar.MINUTE, 0);
      cal.set(Calendar.SECOND, 0);
      cal.set(Calendar.MILLISECOND, 0);
      beginDate = cal.getTime();

      cal.setTime(endDate);
      cal.set(Calendar.HOUR_OF_DAY, 0);
      cal.set(Calendar.MINUTE, 0);
      cal.set(Calendar.SECOND, 0);
      cal.set(Calendar.MILLISECOND, 0);
      endDate = cal.getTime();
    }

    if (!beginDate.before(endDate)) {
      alert("The end date cannot be before/equal than begin date!");
      return;
    }
    String[] colors = ((String) ppcolor.getSelectedItem().getValue()).split(",");
    ce.setHeaderColor(colors[0]);
    ce.setContentColor(colors[1]);
    ce.setBeginDate(beginDate);
    ce.setEndDate(endDate);
    ce.setTitle(txtb_title.getValue());
    ce.setContent(ppcnt.getValue());
    ce.setLocked(pplocked.isChecked());

    // prepare the backend Bean
    MyCalendarEvent calEvt = getCalendarEventService().getNewCalendarEvent();
    calEvt.setId(ce.getId());
    calEvt.setSecUser(ce.getUser());
    calEvt.setVersion(ce.getVersion());
    calEvt.setTitle(ce.getTitle());
    calEvt.setContent(ce.getContent());
    calEvt.setBeginDate(ce.getBeginDate());
    calEvt.setEndDate(ce.getEndDate());
    calEvt.setHeaderColor(ce.getHeaderColor());
    calEvt.setContentColor(ce.getContentColor());

    // Save the calendar event to database
    try {

      getCalendarEventService().saveOrUpdate(calEvt);
View Full Code Here

Examples of de.forsthaus.webui.calendar.model.MySimpleCalendarEvent

      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();
View Full Code Here

Examples of de.forsthaus.webui.calendar.model.MySimpleCalendarEvent

  }

  public void synchronizeModel() throws ParseException {

    SimpleCalendarModel cm = null;
    MySimpleCalendarEvent sce = null;
    Date beginDate = cal.getBeginDate();
    Date endDate = cal.getEndDate();

    // first, delete old stuff
    cm = (SimpleCalendarModel) cal.getModel();

    if (cm != null) {
      cm.clear();
    }

    final SecUser user = ((UserImpl) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getSecUser();
    // List<MyCalendarEvent> list =
    // getCalendarEventService().getAllCalendarEvents(user.getId());
    List<MyCalendarEvent> list = getCalendarEventService().getCalendarEventsFromToDate(beginDate, endDate, user.getId());

    cm = new SimpleCalendarModel();

    for (MyCalendarEvent myCalendarEvent : list) {
      sce = new MySimpleCalendarEvent();
      sce.setId(myCalendarEvent.getId());
      sce.setUser(myCalendarEvent.getSecUser());
      sce.setVersion(myCalendarEvent.getVersion());
      sce.setBeginDate(myCalendarEvent.getBeginDate());
      sce.setContent(myCalendarEvent.getContent());
      sce.setContentColor(myCalendarEvent.getContentColor());
      sce.setEndDate(myCalendarEvent.getEndDate());
      sce.setHeaderColor(myCalendarEvent.getHeaderColor());
      sce.setLocked(myCalendarEvent.isLocked());
      sce.setTitle(myCalendarEvent.getTitle());

      cm.add(sce);
    }
    setCalModel(cm);
View Full Code Here

Examples of de.forsthaus.webui.calendar.model.MySimpleCalendarEvent

        }
      }

      private void deleteBean() {
        // delete from modell
        MySimpleCalendarEvent ce = (MySimpleCalendarEvent) editEventWindow.getAttribute("ce");

        // prepare the backend Bean
        MyCalendarEvent calEvt = getCalendarEventService().getNewCalendarEvent();
        calEvt.setId(ce.getId());
        calEvt.setTitle(ce.getTitle());
        calEvt.setContent(ce.getContent());
        calEvt.setBeginDate(ce.getBeginDate());
        calEvt.setEndDate(ce.getEndDate());
        calEvt.setContentColor(ce.getContentColor());
        calEvt.setVersion(ce.getVersion());

        // delete from db
        try {
          getCalendarEventService().delete(calEvt);
          syncModel();
View Full Code Here

Examples of de.forsthaus.webui.calendar.model.MySimpleCalendarEvent

   * @param event
   */
  public void doSave(Event event) {
    Calendars cals = getCalendarCtrl().getCal();

    MySimpleCalendarEvent ce = new MySimpleCalendarEvent();
    Calendar cal = Calendar.getInstance(cals.getDefaultTimeZone());
    Date beginDate = ppbegin.getValue();
    Date endDate = ppend.getValue();

    beginDate.setSeconds(0);
    endDate.setSeconds(0);
    if (!ppallDay.isChecked()) {
      String[] times = ppbt.getSelectedItem().getLabel().split(":");

      cal.setTime(beginDate);
      cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(times[0]));
      cal.set(Calendar.MINUTE, Integer.parseInt(times[1]));
      cal.set(Calendar.SECOND, 0);
      cal.set(Calendar.MILLISECOND, 0);
      beginDate = cal.getTime();
      times = ppet.getSelectedItem().getLabel().split(":");
      cal.setTime(endDate);
      cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(times[0]));
      cal.set(Calendar.MINUTE, Integer.parseInt(times[1]));
      cal.set(Calendar.SECOND, 0);
      cal.set(Calendar.MILLISECOND, 0);
      endDate = cal.getTime();
    }

    if (!beginDate.before(endDate)) {
      alert("The end date cannot be before/equal than begin date!");
      return;
    }

    String[] colors = ((String) ppcolor.getSelectedItem().getValue()).split(",");
    ce.setHeaderColor(colors[0]);
    ce.setContentColor(colors[1]);
    ce.setBeginDate(beginDate);
    ce.setEndDate(endDate);
    ce.setTitle(txtb_title.getValue());
    ce.setContent(ppcnt.getValue());
    ce.setLocked(pplocked.isChecked());
    getCalendarCtrl().getCalModel().add(ce);

    ppcnt.setRawValue("");
    ppbt.setSelectedIndex(0);
    ppet.setSelectedIndex(0);

    final SecUser user = ((UserImpl) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getSecUser();

    // prepare the backend Bean
    MyCalendarEvent calEvt = getCalendarEventService().getNewCalendarEvent();
    calEvt.setSecUser(user);
    calEvt.setTitle(ce.getTitle());
    calEvt.setContent(ce.getContent());
    calEvt.setBeginDate(ce.getBeginDate());
    calEvt.setEndDate(ce.getEndDate());
    calEvt.setHeaderColor(colors[0]);
    calEvt.setContentColor(ce.getContentColor());

    // Save the calendar event to database
    try {
      getCalendarEventService().saveOrUpdate(calEvt);
      syncModel();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.