示例#1
0
 /** {@inheritDoc} */
 public String getLabel(JaretDate date, Format format) {
   if (format.equals(Format.SHORT)) {
     return Integer.toString(date.getMonth()) + ".";
   } else if (format.equals(Format.MEDIUM)) {
     return date.getShortMonthString() + " " + date.getYear();
   } else {
     return date.getMonthString() + " " + date.getYear();
   }
 }
 public static JaretDate Util2JaretDate(Date utilDate) {
   Calendar cal = Calendar.getInstance();
   cal.setTime(utilDate);
   JaretDate jaretDate = new JaretDate();
   jaretDate.setDateTime(
       cal.get(Calendar.DAY_OF_MONTH),
       cal.get(Calendar.MONTH),
       cal.get(Calendar.YEAR),
       cal.get(Calendar.HOUR_OF_DAY),
       cal.get(Calendar.MINUTE),
       cal.get(Calendar.SECOND),
       cal.get(Calendar.MILLISECOND));
   return jaretDate;
 }
示例#3
0
  public void recalculateTime() {
    JaretDate start = new JaretDate();
    start.setHours(0);
    start.setMinutes(0);
    start.setSeconds((int) cmd.getStartTime());
    start.setMilliseconds(((int) (cmd.getStartTime() * 1000)) % 1000);
    setBegin(start);

    JaretDate end = new JaretDate();
    end.setHours(0);
    end.setMinutes(0);
    end.setSeconds((int) cmd.getEndTime());
    end.setMilliseconds(((int) (cmd.getEndTime() * 1000)) % 1000);
    setEnd(end);
  }
 /**
  * Set the start date value for all viewers but the emitting viewer.
  *
  * @param emitting emitting viewer
  * @param startDate value
  */
 private void setStartDate(TimeBarViewerInterface emitting, JaretDate startDate) {
   for (TimeBarViewerInterface viewer : _viewers) {
     if (!emitting.equals(viewer)) { // do not set on the emitting viewer
       viewer.removePropertyChangeListener(this);
       viewer.setStartDate(startDate.copy());
       viewer.addPropertyChangeListener(this);
     }
   }
 }
示例#5
0
 /** {@inheritDoc} */
 protected JaretDate correctStartDate(JaretDate date) {
   date.setTime(0, 0, 0);
   date.setDay(1);
   return date;
 }
示例#6
0
 /** {@inheritDoc} */
 protected void advanceDate(JaretDate date) {
   date.advanceMonths(1);
 }