Search in sources :

Example 1 with CalendarGUIMoveEvent

use of org.olat.commons.calendar.ui.events.CalendarGUIMoveEvent in project OpenOLAT by OpenOLAT.

the class WeeklyCalendarController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == calendarEl) {
        if (event instanceof CalendarGUIEditEvent) {
            CalendarGUIEditEvent guiEvent = (CalendarGUIEditEvent) event;
            KalendarEvent kalendarEvent = guiEvent.getKalendarEvent();
            if (kalendarEvent == null) {
                // event already deleted
                getWindowControl().setError(translate("cal.error.eventDeleted"));
                return;
            }
            String recurrence = kalendarEvent.getRecurrenceRule();
            boolean isImported = false;
            KalendarRenderWrapper kalendarRenderWrapper = guiEvent.getKalendarRenderWrapper();
            if (kalendarRenderWrapper != null) {
                isImported = kalendarRenderWrapper.isImported();
            }
            if (!isImported && recurrence != null && !recurrence.equals("")) {
                List<String> btnLabels = new ArrayList<>(3);
                btnLabels.add(translate("cal.edit.dialog.sequence"));
                btnLabels.add(translate("cal.edit.dialog.delete.single"));
                btnLabels.add(translate("cal.edit.dialog.delete.sequence"));
                if (dbcSequence != null) {
                    dbcSequence.dispose();
                }
                dbcSequence = DialogBoxUIFactory.createGenericDialog(ureq, getWindowControl(), translate("cal.edit.dialog.title"), translate("cal.edit.dialog.text"), btnLabels);
                dbcSequence.addControllerListener(this);
                dbcSequence.setUserObject(guiEvent);
                dbcSequence.activate();
                return;
            }
            KalendarRenderWrapper kalendarWrapper = guiEvent.getKalendarRenderWrapper();
            pushEditEventController(ureq, kalendarEvent, kalendarWrapper);
        } else if (event instanceof CalendarGUIAddEvent) {
            pushAddEventController((CalendarGUIAddEvent) event, ureq);
        } else if (event instanceof CalendarGUISelectEvent) {
            CalendarGUISelectEvent selectEvent = (CalendarGUISelectEvent) event;
            if (selectEvent.getKalendarEvent() != null) {
                doOpenEventCallout(ureq, selectEvent.getKalendarEvent(), selectEvent.getKalendarRenderWrapper(), selectEvent.getTargetDomId());
            }
        } else if (event instanceof CalendarGUIMoveEvent) {
            CalendarGUIMoveEvent moveEvent = (CalendarGUIMoveEvent) event;
            doMove(ureq, moveEvent.getKalendarEvent(), moveEvent.getDayDelta(), moveEvent.getMinuteDelta(), moveEvent.getAllDay());
        } else if (event instanceof CalendarGUIResizeEvent) {
            CalendarGUIResizeEvent resizeEvent = (CalendarGUIResizeEvent) event;
            doResize(ureq, resizeEvent.getKalendarEvent(), resizeEvent.getMinuteDelta(), resizeEvent.getAllDay());
        } else if (event instanceof CalendarGUIFormEvent) {
            String cmd = event.getCommand();
            if (CalendarGUIFormEvent.CONFIGURE.equals(cmd)) {
                doConfigure(ureq);
            } else if (CalendarGUIFormEvent.AGGREGATED_FEED.equals(cmd)) {
                CalendarGUIFormEvent guiEvent = (CalendarGUIFormEvent) event;
                doOpenAggregatedFeedUrl(ureq, guiEvent.getTargetDomId());
            }
        } else if (event instanceof CalendarGUIPrintEvent) {
            CalendarGUIPrintEvent printEvent = (CalendarGUIPrintEvent) event;
            if (printEvent.getFrom() != null && printEvent.getTo() != null) {
                doPrint(printEvent.getFrom(), printEvent.getTo());
            } else if (printEvent.getTargetDomId() != null) {
                doPrintEventCallout(ureq, printEvent.getTargetDomId());
            }
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : CalendarGUIAddEvent(org.olat.commons.calendar.ui.events.CalendarGUIAddEvent) CalendarGUIEditEvent(org.olat.commons.calendar.ui.events.CalendarGUIEditEvent) CalendarGUIResizeEvent(org.olat.commons.calendar.ui.events.CalendarGUIResizeEvent) ArrayList(java.util.ArrayList) KalendarEvent(org.olat.commons.calendar.model.KalendarEvent) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper) CalendarGUIMoveEvent(org.olat.commons.calendar.ui.events.CalendarGUIMoveEvent) CalendarGUIPrintEvent(org.olat.commons.calendar.ui.events.CalendarGUIPrintEvent) CalendarGUISelectEvent(org.olat.commons.calendar.ui.events.CalendarGUISelectEvent) CalendarGUIFormEvent(org.olat.commons.calendar.ui.events.CalendarGUIFormEvent)

Example 2 with CalendarGUIMoveEvent

use of org.olat.commons.calendar.ui.events.CalendarGUIMoveEvent in project openolat by klemens.

the class WeeklyCalendarController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == calendarEl) {
        if (event instanceof CalendarGUIEditEvent) {
            CalendarGUIEditEvent guiEvent = (CalendarGUIEditEvent) event;
            KalendarEvent kalendarEvent = guiEvent.getKalendarEvent();
            if (kalendarEvent == null) {
                // event already deleted
                getWindowControl().setError(translate("cal.error.eventDeleted"));
                return;
            }
            String recurrence = kalendarEvent.getRecurrenceRule();
            boolean isImported = false;
            KalendarRenderWrapper kalendarRenderWrapper = guiEvent.getKalendarRenderWrapper();
            if (kalendarRenderWrapper != null) {
                isImported = kalendarRenderWrapper.isImported();
            }
            if (!isImported && recurrence != null && !recurrence.equals("")) {
                List<String> btnLabels = new ArrayList<>(3);
                btnLabels.add(translate("cal.edit.dialog.sequence"));
                btnLabels.add(translate("cal.edit.dialog.delete.single"));
                btnLabels.add(translate("cal.edit.dialog.delete.sequence"));
                if (dbcSequence != null) {
                    dbcSequence.dispose();
                }
                dbcSequence = DialogBoxUIFactory.createGenericDialog(ureq, getWindowControl(), translate("cal.edit.dialog.title"), translate("cal.edit.dialog.text"), btnLabels);
                dbcSequence.addControllerListener(this);
                dbcSequence.setUserObject(guiEvent);
                dbcSequence.activate();
                return;
            }
            KalendarRenderWrapper kalendarWrapper = guiEvent.getKalendarRenderWrapper();
            pushEditEventController(ureq, kalendarEvent, kalendarWrapper);
        } else if (event instanceof CalendarGUIAddEvent) {
            pushAddEventController((CalendarGUIAddEvent) event, ureq);
        } else if (event instanceof CalendarGUISelectEvent) {
            CalendarGUISelectEvent selectEvent = (CalendarGUISelectEvent) event;
            if (selectEvent.getKalendarEvent() != null) {
                doOpenEventCallout(ureq, selectEvent.getKalendarEvent(), selectEvent.getKalendarRenderWrapper(), selectEvent.getTargetDomId());
            }
        } else if (event instanceof CalendarGUIMoveEvent) {
            CalendarGUIMoveEvent moveEvent = (CalendarGUIMoveEvent) event;
            doMove(ureq, moveEvent.getKalendarEvent(), moveEvent.getDayDelta(), moveEvent.getMinuteDelta(), moveEvent.getAllDay());
        } else if (event instanceof CalendarGUIResizeEvent) {
            CalendarGUIResizeEvent resizeEvent = (CalendarGUIResizeEvent) event;
            doResize(ureq, resizeEvent.getKalendarEvent(), resizeEvent.getMinuteDelta(), resizeEvent.getAllDay());
        } else if (event instanceof CalendarGUIFormEvent) {
            String cmd = event.getCommand();
            if (CalendarGUIFormEvent.CONFIGURE.equals(cmd)) {
                doConfigure(ureq);
            } else if (CalendarGUIFormEvent.AGGREGATED_FEED.equals(cmd)) {
                CalendarGUIFormEvent guiEvent = (CalendarGUIFormEvent) event;
                doOpenAggregatedFeedUrl(ureq, guiEvent.getTargetDomId());
            }
        } else if (event instanceof CalendarGUIPrintEvent) {
            CalendarGUIPrintEvent printEvent = (CalendarGUIPrintEvent) event;
            if (printEvent.getFrom() != null && printEvent.getTo() != null) {
                doPrint(printEvent.getFrom(), printEvent.getTo());
            } else if (printEvent.getTargetDomId() != null) {
                doPrintEventCallout(ureq, printEvent.getTargetDomId());
            }
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : CalendarGUIAddEvent(org.olat.commons.calendar.ui.events.CalendarGUIAddEvent) CalendarGUIEditEvent(org.olat.commons.calendar.ui.events.CalendarGUIEditEvent) CalendarGUIResizeEvent(org.olat.commons.calendar.ui.events.CalendarGUIResizeEvent) ArrayList(java.util.ArrayList) KalendarEvent(org.olat.commons.calendar.model.KalendarEvent) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper) CalendarGUIMoveEvent(org.olat.commons.calendar.ui.events.CalendarGUIMoveEvent) CalendarGUIPrintEvent(org.olat.commons.calendar.ui.events.CalendarGUIPrintEvent) CalendarGUISelectEvent(org.olat.commons.calendar.ui.events.CalendarGUISelectEvent) CalendarGUIFormEvent(org.olat.commons.calendar.ui.events.CalendarGUIFormEvent)

Example 3 with CalendarGUIMoveEvent

use of org.olat.commons.calendar.ui.events.CalendarGUIMoveEvent in project OpenOLAT by OpenOLAT.

the class FullCalendarElement method doMove.

protected void doMove(UserRequest ureq, String eventId, String dayDelta, String minuteDelta, String allDayStr) {
    Long day = null;
    if (StringHelper.isLong(dayDelta)) {
        day = Long.parseLong(dayDelta);
    }
    Long minute = null;
    if (StringHelper.isLong(minuteDelta)) {
        minute = Long.parseLong(minuteDelta);
    }
    Boolean allDay = null;
    if ("true".equals(allDayStr)) {
        allDay = Boolean.TRUE;
    } else if ("false".equals(allDayStr)) {
        allDay = Boolean.FALSE;
    }
    if (component.isOccurenceOfCalendarEvent(eventId)) {
        String uid = component.getCalendarEventUid(eventId);
        KalendarRenderWrapper cal = component.getCalendarById(uid);
        KalendarRecurEvent rEvent = getCurrenceKalendarEvent(cal, eventId);
        getRootForm().fireFormEvent(ureq, new CalendarGUIMoveEvent(this, rEvent, cal, day, minute, allDay));
    } else if (component.isReccurenceOfCalendarEvent(eventId)) {
        String uid = component.getCalendarEventUid(eventId);
        KalendarRenderWrapper cal = component.getCalendarById(uid);
        KalendarRecurEvent rEvent = getCurrenceKalendarEvent(cal, eventId);
        getRootForm().fireFormEvent(ureq, new CalendarGUIMoveEvent(this, rEvent, cal, day, minute, allDay));
    } else {
        KalendarEvent event = component.getCalendarEvent(eventId);
        KalendarRenderWrapper calWrapper = component.getCalendarByNormalizedId(eventId);
        getRootForm().fireFormEvent(ureq, new CalendarGUIMoveEvent(this, event, calWrapper, day, minute, allDay));
    }
}
Also used : CalendarGUIMoveEvent(org.olat.commons.calendar.ui.events.CalendarGUIMoveEvent) KalendarRecurEvent(org.olat.commons.calendar.model.KalendarRecurEvent) KalendarEvent(org.olat.commons.calendar.model.KalendarEvent)

Example 4 with CalendarGUIMoveEvent

use of org.olat.commons.calendar.ui.events.CalendarGUIMoveEvent in project openolat by klemens.

the class FullCalendarElement method doMove.

protected void doMove(UserRequest ureq, String eventId, String dayDelta, String minuteDelta, String allDayStr) {
    Long day = null;
    if (StringHelper.isLong(dayDelta)) {
        day = Long.parseLong(dayDelta);
    }
    Long minute = null;
    if (StringHelper.isLong(minuteDelta)) {
        minute = Long.parseLong(minuteDelta);
    }
    Boolean allDay = null;
    if ("true".equals(allDayStr)) {
        allDay = Boolean.TRUE;
    } else if ("false".equals(allDayStr)) {
        allDay = Boolean.FALSE;
    }
    if (component.isOccurenceOfCalendarEvent(eventId)) {
        String uid = component.getCalendarEventUid(eventId);
        KalendarRenderWrapper cal = component.getCalendarById(uid);
        KalendarRecurEvent rEvent = getCurrenceKalendarEvent(cal, eventId);
        getRootForm().fireFormEvent(ureq, new CalendarGUIMoveEvent(this, rEvent, cal, day, minute, allDay));
    } else if (component.isReccurenceOfCalendarEvent(eventId)) {
        String uid = component.getCalendarEventUid(eventId);
        KalendarRenderWrapper cal = component.getCalendarById(uid);
        KalendarRecurEvent rEvent = getCurrenceKalendarEvent(cal, eventId);
        getRootForm().fireFormEvent(ureq, new CalendarGUIMoveEvent(this, rEvent, cal, day, minute, allDay));
    } else {
        KalendarEvent event = component.getCalendarEvent(eventId);
        KalendarRenderWrapper calWrapper = component.getCalendarByNormalizedId(eventId);
        getRootForm().fireFormEvent(ureq, new CalendarGUIMoveEvent(this, event, calWrapper, day, minute, allDay));
    }
}
Also used : CalendarGUIMoveEvent(org.olat.commons.calendar.ui.events.CalendarGUIMoveEvent) KalendarRecurEvent(org.olat.commons.calendar.model.KalendarRecurEvent) KalendarEvent(org.olat.commons.calendar.model.KalendarEvent)

Aggregations

KalendarEvent (org.olat.commons.calendar.model.KalendarEvent)4 CalendarGUIMoveEvent (org.olat.commons.calendar.ui.events.CalendarGUIMoveEvent)4 ArrayList (java.util.ArrayList)2 KalendarRecurEvent (org.olat.commons.calendar.model.KalendarRecurEvent)2 KalendarRenderWrapper (org.olat.commons.calendar.ui.components.KalendarRenderWrapper)2 CalendarGUIAddEvent (org.olat.commons.calendar.ui.events.CalendarGUIAddEvent)2 CalendarGUIEditEvent (org.olat.commons.calendar.ui.events.CalendarGUIEditEvent)2 CalendarGUIFormEvent (org.olat.commons.calendar.ui.events.CalendarGUIFormEvent)2 CalendarGUIPrintEvent (org.olat.commons.calendar.ui.events.CalendarGUIPrintEvent)2 CalendarGUIResizeEvent (org.olat.commons.calendar.ui.events.CalendarGUIResizeEvent)2 CalendarGUISelectEvent (org.olat.commons.calendar.ui.events.CalendarGUISelectEvent)2