Package org.projectforge.common

Examples of org.projectforge.common.DateHolder


  @Override
  public void onBeforeRender()
  {
    super.onBeforeRender();
    final DateHolder stopDateHolder = new DateHolder(data.getStopTime(), DatePrecision.MINUTE_15);
    stopHourOfDay = stopDateHolder.getHourOfDay();
    stopMinute = stopDateHolder.getMinute();
  }
View Full Code Here


         * @see org.apache.wicket.model.Model#getObject()
         */
        @Override
        public Date getObject()
        {
          final DateHolder dh = new DateHolder();
          dh.setDate(filter.getYear(), filter.getMonth(), 1, 0, 0, 0);
          return dh.getDate();
        }

        /**
         * @see org.apache.wicket.model.Model#setObject(java.io.Serializable)
         */
 
View Full Code Here

    }
  }

  void setDate(final Date date)
  {
    final DateHolder dh = new DateHolder(date);
    filter.setYear(dh.getYear());
    filter.setMonth(dh.getMonth());
    yearChoice.modelChanged();
    monthChoice.modelChanged();
  }
View Full Code Here

  private void refreshYearList()
  {
    final int[] years;
    if (filter.getUser() == null) {
      years = new int[] { new DateHolder().getYear()};
    } else {
      years = timesheetDao.getYears(filter.getUser().getId());
    }
    final LabelValueChoiceRenderer<Integer> yearChoiceRenderer = new LabelValueChoiceRenderer<Integer>();
    for (final int year : years) {
View Full Code Here

      TimePeriod timePeriod = form.scriptParameters.get(idx).getTimePeriodValue();
      if (timePeriod == null) {
        timePeriod = new TimePeriod();
      }
      timePeriod.setFromDate(date);
      final DateHolder dateHolder = new DateHolder(date);
      if (property.endsWith(".month") == true) {
        dateHolder.setEndOfMonth();
      } else if (property.endsWith(".week") == true) {
        dateHolder.setEndOfWeek();
      } else {
        log.error("Property '" + property + "' not supported for selection.");
      }
      timePeriod.setToDate(dateHolder.getDate());
      form.scriptParameters.get(idx).setTimePeriodValue(timePeriod);
      form.datePanel1[idx].markModelAsChanged();
      form.datePanel2[idx].markModelAsChanged();
    } else if (property.startsWith("taskId:") == true) {
      final TaskDO task = taskDao.getById((Integer) selectedValue);
View Full Code Here

  public static String getUTCDate(final Date date)
  {
    if (date == null) {
      return "";
    }
    final DateHolder dh = new DateHolder(date);
    return DateHelper.TECHNICAL_ISO_UTC.get().format(dh.getDate());
  }
View Full Code Here

  public static String getUTCDate(final String label, final Date date)
  {
    if (date == null) {
      return label + ":";
    }
    final DateHolder dh = new DateHolder(date);
    return label + ": " + DateHelper.TECHNICAL_ISO_UTC.get().format(dh.getDate());
  }
View Full Code Here

   * @param stopTime Stop time or null.
   */
  public static String getUTCDates(final Date startTime, final Date stopTime)
  {
    final StringBuffer buf = new StringBuffer();
    final DateHolder start = startTime != null ? new DateHolder(startTime) : null;
    final DateHolder stop = stopTime != null ? new DateHolder(stopTime) : null;
    if (start != null) {
      buf.append(DateHelper.TECHNICAL_ISO_UTC.get().format(start.getDate()));
      if (stop != null) {
        buf.append(" - ");
      }
    }
    if (stop != null) {
      buf.append(DateHelper.TECHNICAL_ISO_UTC.get().format(stop.getDate()));
    }
    return buf.toString();
  }
View Full Code Here

   */
  public MonthlyEmployeeReportWeek(Date fromDate)
  {
    Validate.notNull(fromDate);
    this.fromDate = fromDate;
    DateHolder d1 = new DateHolder(fromDate);
    this.fromDayOfMonth = d1.getDayOfMonth();
    this.weekOfYear = d1.getWeekOfYear();
    d1.setEndOfMonth();
    DateHolder d2 = new DateHolder(fromDate);
    d2.setEndOfWeek();
    if (d1.getDate().before(d2.getDate()) == true) {
      this.toDate = d1.getDate();
      this.toDayOfMonth = d1.getDayOfMonth();
    } else {
      this.toDate = d2.getDate();
      this.toDayOfMonth = d2.getDayOfMonth();
    }
  }
View Full Code Here

      if (pos >= 0) {
        number = NumberHelper.parseInteger(modificationSince.substring(pos + 1));
      } else {
        number = null;
      }
      final DateHolder dateHolder = new DateHolder(DatePrecision.MINUTE);
      if ("lastMinute".equals(modificationSince) == true) {
        dateHolder.add(Calendar.MINUTE, -1);
      } else if (modificationSince.startsWith("lastMinutes:") == true) {
        dateHolder.add(Calendar.MINUTE, -number);
      } else if ("lastHour".equals(modificationSince) == true) {
        dateHolder.add(Calendar.HOUR, -1);
      } else if (modificationSince.startsWith("lastHours:") == true) {
        dateHolder.add(Calendar.HOUR, -number);
      } else if ("today".equals(modificationSince) == true) {
        dateHolder.setBeginOfDay();
      } else if ("sinceYesterday".equals(modificationSince) == true) {
        dateHolder.add(Calendar.DAY_OF_YEAR, -1);
        dateHolder.setBeginOfDay();
      } else if (modificationSince.startsWith("lastDays") == true) {
        dateHolder.add(Calendar.DAY_OF_YEAR, -number);
        dateHolder.setBeginOfDay();
      }
      searchFilter.setStartTimeOfModification(dateHolder.getDate());
      startDateTimePanel.markModelAsChanged();
      searchFilter.setStopTimeOfModification(null);
      stopDateTimePanel.markModelAsChanged();
      modificationSince = null;
    }
View Full Code Here

TOP

Related Classes of org.projectforge.common.DateHolder

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.