Package org.timepedia.chronoscope.client.util.date

Examples of org.timepedia.chronoscope.client.util.date.FastChronoDate


    currTick.setTime(timestamp);
  }
 
  @Override
  public String getRangeLabel(Interval interval) {
    FastChronoDate i = new FastChronoDate(interval.getStart());
    FastChronoDate e = new FastChronoDate(interval.getEnd());
   
    DateFormatter common = null;
    DateFormatter prev = null;
    boolean useformat = true;
    if (timeUnitTickInterval.ms() < TimeUnit.DAY.ms()) {
      if (i.getYear() != e.getYear() || i.getMonth() != e.getMonth()) {
        common = DateFormatHelper.yearFormatter;
        prev = DateFormatHelper.monthDayFormatter;
      } else if (!dateFormat.day(i).equals(dateFormat.day(e))) {
        common = DateFormatHelper.yearMonthFormatter;
        prev = DateFormatHelper.dayFormatter;
      } else {
        common = DateFormatHelper.yearMonthDayFormatter;
      }
    } else if (timeUnitTickInterval == TimeUnit.DAY) {
      prev = DateFormatHelper.yearMonthDayFormatter;
      useformat = false;
    }

   
    String ret = "";
    if (common != null) {
      ret += common.format(i.getOffsetTime()) + ", ";
    }
    if (prev != null) {
      if (false == useformat) {
        ret += prev.format(i.getOffsetTime()) + " - " + prev.format(e.getOffsetTime());
      } else {
        ret += prev.format(i.getOffsetTime()) + "/" + format(i) + " - " + prev.format(e.getOffsetTime()) + "/" + format(e);
      }
    } else {
      ret += getRangeLabelCompact(interval);
    }
   
View Full Code Here


    return super.formatCrosshair(tick);
  }
 
  @Override
  public String getRangeLabelCompact(Interval interval) {
    FastChronoDate i = new FastChronoDate(interval.getStart());
    FastChronoDate e = new FastChronoDate(interval.getEnd());
    return format(i) + " - " + format(e);
  }
View Full Code Here

      if (hoverX > 0) {
        // consider painting crosshair line on overlay layer for Z order underneath (behind) the points
        hoverLayer.fillRect(hoverX-0.5, 0.5, 1, hoverLayer.getBounds().height);
        int hx = hoverX;
        double dx = windowXtoDomain(hoverX + plotBounds.x);
        ChronoDate cronoDate = new FastChronoDate(dx);

        if (ChronoscopeOptions.isCrosshairDateTimeFormat()) {
          if (crosshairFmt == null && !"auto".equals(ChronoscopeOptions.getCrosshairDateTimeFormat())) {
            crosshairFmt = DateFormatterFactory.getInstance().getDateFormatter(ChronoscopeOptions.getCrosshairDateTimeFormat());
          }
          String label;
          if (crosshairFmt != null) {
            label = crosshairFmt.format(cronoDate.getOffsetTime());
          } else {
            label = getTickFormater().formatCrosshair(cronoDate);
          }
          int labelWidth = hoverLayer.stringWidth(label, "Helvetica", "", "8pt");
          int labelHeight = hoverLayer.stringHeight(label, "Helvetica", "", "8pt");
View Full Code Here

      }
    }
  }
 
  private ChronoDate createTestDateFromMs(double ms) {
    return new FastChronoDate(ms);
  }
View Full Code Here

  private static ChronoDate createTestDate(int year, int month, int day) {
    return createTestDate(year, month, day, 0, 0, 0, 0);
  }
 
  private static ChronoDate createTestDate(int year, int month, int day, int hr, int min, int sec, int ms) {
    ChronoDate d = new FastChronoDate(year, month, day);
    d.set().hour(hr).min(min).sec(sec).ms(ms).done();
    return d;
  }
View Full Code Here

    long expectedTimestamp = createJavaDate(yr, mo, day, hr, min, sec).getTime();
    assertEquals(expectedTimestamp, (long)d.getTime());
  }
 
  public void testSetMillenium() {
    ChronoDate d = new FastChronoDate(-2345, 5, 25);
    d.set(TimeUnit.MILLENIUM, 1);
    assertEquals(1345, 5, 25, d);
   
    d = new FastChronoDate(-2345, 5, 25);
    d.set(TimeUnit.MILLENIUM, -30);
    assertEquals(-30345, 5, 25, d);
  }
View Full Code Here

TOP

Related Classes of org.timepedia.chronoscope.client.util.date.FastChronoDate

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.