/** * Sets the time zone that is used to convert the time periods into * absolute milliseconds. * * @param zone the time zone ({@code null} not permitted). */ public void setTimeZone(TimeZone zone) { Args.nullNotPermitted(zone, "zone"); this.timeZone = zone; this.calendar = Calendar.getInstance(zone, this.locale); this.first.peg(this.calendar); this.last.peg(this.calendar); fireChangeEvent(); }
/** * Sets the time zone that is used to convert the time periods into * absolute milliseconds. * * @param zone the time zone (<code>null</code> not permitted). */ public void setTimeZone(TimeZone zone) { if (zone == null) { throw new IllegalArgumentException("Null 'zone' argument."); } this.timeZone = zone; this.calendar = Calendar.getInstance(zone, this.locale); this.first.peg(this.calendar); this.last.peg(this.calendar); notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the first time period in the axis range and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param first the time period ({@code null} not permitted). */ public void setFirst(RegularTimePeriod first) { Args.nullNotPermitted(first, "first"); this.first = first; this.first.peg(this.calendar); fireChangeEvent(); }
/** * Sets the first time period in the axis range and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param first the time period (<code>null</code> not permitted). */ public void setFirst(RegularTimePeriod first) { if (first == null) { throw new IllegalArgumentException("Null 'first' argument."); } this.first = first; this.first.peg(this.calendar); notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the last time period in the axis range and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param last the time period (<code>null</code> not permitted). */ public void setLast(RegularTimePeriod last) { if (last == null) { throw new IllegalArgumentException("Null 'last' argument."); } this.last = last; this.last.peg(this.calendar); notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the last time period in the axis range and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param last the time period ({@code null} not permitted). */ public void setLast(RegularTimePeriod last) { Args.nullNotPermitted(last, "last"); this.last = last; this.last.peg(this.calendar); fireChangeEvent(); }
public static void normaliseDateRangeCount(Map<RegularTimePeriod, Number> dateMap, int days, Class period, TimeZone timeZone) { // find earliest date, then move it forwards until we hit now Calendar cal = Calendar.getInstance(timeZone); cal.add(Calendar.DAY_OF_MONTH, - days); Date earliest = cal.getTime(); RegularTimePeriod cursor = RegularTimePeriod.createInstance(period, earliest, timeZone); RegularTimePeriod end = RegularTimePeriod.createInstance(period, new Date(), timeZone); //fix for JRA-11686. Prevents the loop from looping infinitely. while (cursor != null && cursor.compareTo(end) <= 0) { if (!dateMap.containsKey(cursor)) { dateMap.put(cursor, 0); } cursor = cursor.next(); cursor.peg(cal); } }
public static void normaliseDateRange(Map<RegularTimePeriod, List<Long>> dateMap, int days, Class period, TimeZone timeZone) { // find earliest date, then move it forwards until we hit now Calendar cal = Calendar.getInstance(timeZone); cal.add(Calendar.DAY_OF_MONTH, - days); Date earliest = cal.getTime(); RegularTimePeriod cursor = RegularTimePeriod.createInstance(period, earliest, timeZone); RegularTimePeriod end = RegularTimePeriod.createInstance(period, new Date(), timeZone); //fix for JRA-11686. Prevents the loop from looping infinitely. while (cursor != null && cursor.compareTo(end) <= 0) { if (!dateMap.containsKey(cursor)) { dateMap.put(cursor, Lists.newArrayList((long) 0)); } cursor = cursor.next(); cursor.peg(cal); } }
/** * Adds a new data item to the dataset and, if requested, sends a * {@link DatasetChangeEvent} to all registered listeners. * * @param period the time period ({@code null} not permitted). * @param y the value for this period ({@code null} permitted). * @param seriesName the name of the series to add the value * ({@code null} not permitted). * @param notify whether dataset listener are notified or not. * * @see #remove(TimePeriod, Comparable, boolean) */ public void add(TimePeriod period, Number y, Comparable seriesName, boolean notify) { // here's a quirk - the API has been defined in terms of a plain // TimePeriod, which cannot make use of the timezone and locale // specified in the constructor...so we only do the time zone // pegging if the period is an instanceof RegularTimePeriod if (period instanceof RegularTimePeriod) { RegularTimePeriod p = (RegularTimePeriod) period; p.peg(this.workingCalendar); } this.values.addValue(y, period, seriesName); if (notify) { fireDatasetChanged(); } }
/** * Adds a new data item to the dataset and, if requested, sends a * {@link DatasetChangeEvent} to all registered listeners. * * @param period the time period (<code>null</code> not permitted). * @param y the value for this period (<code>null</code> permitted). * @param seriesName the name of the series to add the value * (<code>null</code> not permitted). * @param notify whether dataset listener are notified or not. * * @see #remove(TimePeriod, String, boolean) */ public void add(TimePeriod period, Number y, String seriesName, boolean notify) { // here's a quirk - the API has been defined in terms of a plain // TimePeriod, which cannot make use of the timezone and locale // specified in the constructor...so we only do the time zone // pegging if the period is an instanceof RegularTimePeriod if (period instanceof RegularTimePeriod) { RegularTimePeriod p = (RegularTimePeriod) period; p.peg(this.workingCalendar); } this.values.addValue(y, period, seriesName); if (notify) { fireDatasetChanged(); } }
cursor.peg(cal);
cursor.peg(calendar);
p = p.next(); p.peg(this.calendar);
p = p.next(); p.peg(this.calendar);