/** * Sets the date format override. If this is non-null, then it will be * used to format the dates on the axis. * * @param formatter the date formatter (<code>null</code> permitted). */ public void setDateFormatOverride(DateFormat formatter) { this.dateFormatOverride = formatter; notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the tick mark position (start, middle or end of the time period) * and sends an {@link AxisChangeEvent} to all registered listeners. * * @param position the position (<code>null</code> not permitted). */ public void setTickMarkPosition(DateTickMarkPosition position) { if (position == null) { throw new IllegalArgumentException("Null 'position' argument."); } this.tickMarkPosition = position; notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the underlying timeline to use for this axis. * <P> * If the timeline is changed, an {@link AxisChangeEvent} is sent to all * registered listeners. * * @param timeline the timeline. */ public void setTimeline(Timeline timeline) { if (this.timeline != timeline) { this.timeline = timeline; notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets the tick unit attribute. * * @param unit the new tick unit. * @param notify notify registered listeners? * @param turnOffAutoSelection turn off auto selection? * * @see #getTickUnit() */ public void setTickUnit(DateTickUnit unit, boolean notify, boolean turnOffAutoSelection) { this.tickUnit = unit; if (turnOffAutoSelection) { setAutoTickUnitSelection(false, false); } if (notify) { notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets the time zone for the axis and sends an {@link AxisChangeEvent} to * all registered listeners. * * @param zone the time zone (<code>null</code> not permitted). * * @since 1.0.4 * * @see #getTimeZone() */ public void setTimeZone(TimeZone zone) { if (zone == null) { throw new IllegalArgumentException("Null 'zone' argument."); } if (!this.timeZone.equals(zone)) { this.timeZone = zone; setStandardTickUnits(createStandardDateTickUnits(zone, this.locale)); notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets the minimum date visible on the axis and sends an * {@link AxisChangeEvent} to all registered listeners. If * <code>date</code> is on or after the current maximum date for * the axis, the maximum date will be shifted to preserve the current * length of the axis. * * @param date the date (<code>null</code> not permitted). * * @see #getMinimumDate() * @see #setMaximumDate(Date) */ public void setMinimumDate(Date date) { if (date == null) { throw new IllegalArgumentException("Null 'date' argument."); } // check the new minimum date relative to the current maximum date Date maxDate = getMaximumDate(); long maxMillis = maxDate.getTime(); long newMinMillis = date.getTime(); if (maxMillis <= newMinMillis) { Date oldMin = getMinimumDate(); long length = maxMillis - oldMin.getTime(); maxDate = new Date(newMinMillis + length); } setRange(new DateRange(date, maxDate), true, false); notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the maximum date visible on the axis and sends an * {@link AxisChangeEvent} to all registered listeners. If * <code>maximumDate</code> is on or before the current minimum date for * the axis, the minimum date will be shifted to preserve the current * length of the axis. * * @param maximumDate the date (<code>null</code> not permitted). * * @see #getMinimumDate() * @see #setMinimumDate(Date) */ public void setMaximumDate(Date maximumDate) { if (maximumDate == null) { throw new IllegalArgumentException("Null 'maximumDate' argument."); } // check the new maximum date relative to the current minimum date Date minDate = getMinimumDate(); long minMillis = minDate.getTime(); long newMaxMillis = maximumDate.getTime(); if (minMillis >= newMaxMillis) { Date oldMax = getMaximumDate(); long length = oldMax.getTime() - minMillis; minDate = new Date(newMaxMillis - length); } setRange(new DateRange(minDate, maximumDate), true, false); notifyListeners(new AxisChangeEvent(this)); }