Package org.projectforge.plugins.teamcal.integration

Examples of org.projectforge.plugins.teamcal.integration.TemplateEntry


   * @see org.projectforge.web.calendar.MyFullCalendarEventsProvider#buildEvents(org.joda.time.DateTime, org.joda.time.DateTime)
   */
  @Override
  protected void buildEvents(final DateTime start, final DateTime end)
  {
    final TemplateEntry activeTemplateEntry = filter.getActiveTemplateEntry();
    if (activeTemplateEntry == null) {
      // Nothing to build.
      return;
    }
    final Set<Integer> visibleCalendars = activeTemplateEntry.getVisibleCalendarIds();
    if (CollectionUtils.isEmpty(visibleCalendars) == true) {
      // Nothing to build.
      return;
    }
    final TeamEventFilter eventFilter = new TeamEventFilter();
    eventFilter.setTeamCals(visibleCalendars);
    eventFilter.setStartDate(start.toDate());
    eventFilter.setEndDate(end.toDate());
    eventFilter.setUser(PFUserContext.getUser());
    final List<TeamEvent> teamEvents = teamEventDao.getEventList(eventFilter, true);

    boolean longFormat = false;
    days = Days.daysBetween(start, end).getDays();
    if (days < 10) {
      // Week or day view:
      longFormat = true;
    }

    final TeamCalRight right = new TeamCalRight();
    final PFUserDO user = PFUserContext.getUser();
    final TimeZone timeZone = PFUserContext.getTimeZone();
    if (CollectionUtils.isNotEmpty(teamEvents) == true) {
      for (final TeamEvent teamEvent : teamEvents) {
        final DateTime startDate = new DateTime(teamEvent.getStartDate(), PFUserContext.getDateTimeZone());
        final DateTime endDate = new DateTime(teamEvent.getEndDate(), PFUserContext.getDateTimeZone());
        final TeamEventDO eventDO;
        final TeamCalEventId id = new TeamCalEventId(teamEvent, timeZone);
        if (teamEvent instanceof TeamEventDO) {
          eventDO = (TeamEventDO) teamEvent;
        } else {
          eventDO = ((TeamRecurrenceEvent) teamEvent).getMaster();
        }
        teamEventMap.put(id.toString(), teamEvent);
        final MyEvent event = new MyEvent();
        event.setClassName(EVENT_CLASS_NAME + " " + EventDroppedCallbackScriptGenerator.NO_CONTEXTMENU_INDICATOR);
        event.setId("" + id);
        event.setColor(activeTemplateEntry.getColorCode(eventDO.getCalendarId()));

        if (eventRight.hasUpdateAccess(PFUserContext.getUser(), eventDO, null)) {
          event.setEditable(true);
        } else {
          event.setEditable(false);
View Full Code Here


   * Opens the dialog for adding a new entry.
   */
  public TeamCalFilterDialog openNew(final AjaxRequestTarget target, final String newTemplateName)
  {
    backupFilter = new TeamCalCalendarFilter().copyValuesFrom(filter);
    final TemplateEntry newTemplate = new TemplateEntry();
    newTemplate.setName(newTemplateName);
    filter.add(newTemplate);
    super.open(target);
    return this;
  }
View Full Code Here

  {
    if (filter.isModified(backupFilter) == false) {
      // Do nothing.
      return;
    }
    final TemplateEntry activeTemplateEntry = filter.getActiveTemplateEntry();
    if (activeTemplateEntry != null) {
      activeTemplateEntry.setDirty();
    }
    filter.setSelectedCalendar(TemplateEntry.calcCalendarStringForCalendar(activeTemplateEntry.getDefaultCalendarId()));
    setResponsePage(getPage().getClass(), getPage().getPageParameters());
  }
View Full Code Here

      }
    };
    templateName.setType(String.class).setOutputMarkupId(true);
    fs.add(templateName);

    final TemplateEntry activeTemplateEntry = filter.getActiveTemplateEntry();
    selectedCalendars.clear();
    if (activeTemplateEntry != null) {
      selectedCalendars.addAll(activeTemplateEntry.getCalendars());
    }
  }
View Full Code Here

      private static final long serialVersionUID = 1L;

      @Override
      protected void onUpdate(final AjaxRequestTarget target)
      {
        final TemplateEntry activeTemplateEntry = filter.getActiveTemplateEntry();
        final Set<Integer> oldCalIds = activeTemplateEntry.getCalendarIds();
        final List<Integer> newIds = new LinkedList<Integer>();
        // add new keys
        for (final TeamCalDO calendar : selectedCalendars) {
          if (oldCalIds.contains(calendar.getId()) == false) {
            activeTemplateEntry.addNewCalendarProperties(filter, calendar.getId());
          }
          newIds.add(calendar.getId());
        }
        // delete removed keys
        for (final Integer key : oldCalIds) {
          if (newIds.contains(key) == false) {
            activeTemplateEntry.removeCalendarProperties(key);
          }
        }
        updateComponents(target);
      }
    });
View Full Code Here

       */
      @Override
      protected void onBeforeRender()
      {
        super.onBeforeRender();
        final TemplateEntry activeTemplateEntry = filter.getActiveTemplateEntry();
        final List<TeamCalDO> result = new ArrayList<TeamCalDO>();
        if (activeTemplateEntry != null) {
          for (final TeamCalDO cal : activeTemplateEntry.getCalendars()) {
            if (teamEventRight.hasUpdateAccess(PFUserContext.getUser(), cal) == true) {
              // User is allowed to insert events to this calendar:
              result.add(cal);
            }
          }
View Full Code Here

  }

  private void updateComponents(final AjaxRequestTarget target)
  {
    selectedCalendars.clear();
    final TemplateEntry activeTemplateEntry = filter.getActiveTemplateEntry();
    selectedCalendars.addAll(activeTemplateEntry.getCalendars());
    redrawTimesheetsUserControls();
    redrawOptionControls();
    calendarColorPanel.redraw(activeTemplateEntry, selectedCalendars);
    teamCalsChoice.modelChanged();
    target.add(teamCalsChoice, calendarColorPanel.main, templateName, defaultCalendarSelect, optionsControls);
View Full Code Here

    }
  }

  public PFUserDO getTimesheetsUser()
  {
    final TemplateEntry activeTemplateEntry = filter.getActiveTemplateEntry();
    if (activeTemplateEntry == null) {
      return null;
    }
    final Integer userId = activeTemplateEntry.getTimesheetUserId();
    return userId != null ? Registry.instance().getUserGroupCache().getUser(userId) : null;
  }
View Full Code Here

    return userId != null ? Registry.instance().getUserGroupCache().getUser(userId) : null;
  }

  public void setTimesheetsUser(final PFUserDO user)
  {
    final TemplateEntry activeTemplateEntry = filter.getActiveTemplateEntry();
    if (activeTemplateEntry == null) {
      return;
    }
    if (user == null) {
      activeTemplateEntry.setTimesheetUserId(null);
    } else {
      activeTemplateEntry.setTimesheetUserId(user.getId());
    }
  }
View Full Code Here

TOP

Related Classes of org.projectforge.plugins.teamcal.integration.TemplateEntry

Copyright © 2018 www.massapicom. 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.