From: <mu...@us...> - 2008-09-04 21:55:01
|
Revision: 1571 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1571&view=rev Author: mungady Date: 2008-09-04 21:54:58 +0000 (Thu, 04 Sep 2008) Log Message: ----------- Synchronised with 1.0.x branch. Modified Paths: -------------- trunk/source/org/jfree/chart/axis/Axis.java trunk/source/org/jfree/chart/axis/CategoryAxis3D.java trunk/source/org/jfree/chart/axis/CyclicNumberAxis.java trunk/source/org/jfree/chart/axis/ExtendedCategoryAxis.java trunk/source/org/jfree/chart/axis/ModuloAxis.java trunk/source/org/jfree/chart/axis/NumberAxis.java trunk/source/org/jfree/chart/axis/PeriodAxis.java trunk/source/org/jfree/chart/axis/PeriodAxisLabelInfo.java trunk/source/org/jfree/chart/axis/QuarterDateFormat.java trunk/source/org/jfree/chart/axis/SegmentedTimeline.java trunk/source/org/jfree/chart/axis/ValueAxis.java Modified: trunk/source/org/jfree/chart/axis/Axis.java =================================================================== --- trunk/source/org/jfree/chart/axis/Axis.java 2008-09-04 21:54:02 UTC (rev 1570) +++ trunk/source/org/jfree/chart/axis/Axis.java 2008-09-04 21:54:58 UTC (rev 1571) @@ -78,6 +78,7 @@ * 22-Aug-2006 : API doc updates (DG); * 20-Jun-2007 : Removed JCommon dependencies (DG); * 02-Jul-2007 : Modifications to support entities for axis labels (DG); + * 06-Jun-2008 : Added setTickLabelInsets(RectangleInsets, boolean) (DG); * */ @@ -446,12 +447,27 @@ * @see #getLabelInsets() */ public void setLabelInsets(RectangleInsets insets) { + setLabelInsets(insets, true); + } + + /** + * Sets the insets for the axis label, and sends an {@link AxisChangeEvent} + * to all registered listeners. + * + * @param insets the insets (<code>null</code> not permitted). + * @param notify notify listeners? + * + * @since 1.0.10 + */ + public void setLabelInsets(RectangleInsets insets, boolean notify) { if (insets == null) { throw new IllegalArgumentException("Null 'insets' argument."); } if (!insets.equals(this.labelInsets)) { this.labelInsets = insets; - notifyListeners(new AxisChangeEvent(this)); + if (notify) { + notifyListeners(new AxisChangeEvent(this)); + } } } Modified: trunk/source/org/jfree/chart/axis/CategoryAxis3D.java =================================================================== --- trunk/source/org/jfree/chart/axis/CategoryAxis3D.java 2008-09-04 21:54:02 UTC (rev 1570) +++ trunk/source/org/jfree/chart/axis/CategoryAxis3D.java 2008-09-04 21:54:58 UTC (rev 1571) @@ -71,7 +71,7 @@ * Used for bar charts and line charts. */ public class CategoryAxis3D extends CategoryAxis - implements Cloneable, Serializable { + implements Cloneable, Serializable { /** For serialization. */ private static final long serialVersionUID = 4114732251353700972L; Modified: trunk/source/org/jfree/chart/axis/CyclicNumberAxis.java =================================================================== --- trunk/source/org/jfree/chart/axis/CyclicNumberAxis.java 2008-09-04 21:54:02 UTC (rev 1570) +++ trunk/source/org/jfree/chart/axis/CyclicNumberAxis.java 2008-09-04 21:54:58 UTC (rev 1571) @@ -126,6 +126,9 @@ */ public class CyclicNumberAxis extends NumberAxis { + /** For serialization. */ + static final long serialVersionUID = -7514160997164582554L; + /** The default axis line stroke. */ public static Stroke DEFAULT_ADVANCE_LINE_STROKE = new BasicStroke(1.0f); @@ -1006,9 +1009,8 @@ double il = 0; if (isTickMarksVisible()) { - float xx = (float) valueToJava2D( - getRange().getUpperBound(), dataArea, edge - ); + float xx = (float) valueToJava2D(getRange().getUpperBound(), + dataArea, edge); Line2D mark = null; g2.setStroke(getTickMarkStroke()); g2.setPaint(getTickMarkPaint()); Modified: trunk/source/org/jfree/chart/axis/ExtendedCategoryAxis.java =================================================================== --- trunk/source/org/jfree/chart/axis/ExtendedCategoryAxis.java 2008-09-04 21:54:02 UTC (rev 1570) +++ trunk/source/org/jfree/chart/axis/ExtendedCategoryAxis.java 2008-09-04 21:54:58 UTC (rev 1571) @@ -69,6 +69,9 @@ */ public class ExtendedCategoryAxis extends CategoryAxis { + /** For serialization. */ + static final long serialVersionUID = -3004429093959826567L; + /** Storage for the sublabels. */ private Map sublabels; Modified: trunk/source/org/jfree/chart/axis/ModuloAxis.java =================================================================== --- trunk/source/org/jfree/chart/axis/ModuloAxis.java 2008-09-04 21:54:02 UTC (rev 1570) +++ trunk/source/org/jfree/chart/axis/ModuloAxis.java 2008-09-04 21:54:58 UTC (rev 1571) @@ -36,6 +36,7 @@ * ------- * 13-Aug-2004 : Version 1 (DG); * 20-Jun-2007 : Removed JCommon dependencies (DG); + * 13-Nov-2007 : Implemented equals() (DG); * */ @@ -115,11 +116,8 @@ setRange(this.displayStart, this.displayEnd); } else { - setRange( - this.displayStart, - this.fixedRange.getUpperBound() - + (this.displayEnd - this.fixedRange.getLowerBound()) - ); + setRange(this.displayStart, this.fixedRange.getUpperBound() + + (this.displayEnd - this.fixedRange.getLowerBound())); } notifyListeners(new AxisChangeEvent(this)); } @@ -404,4 +402,31 @@ return (length / axisLength) * areaLength; } + /** + * Tests this axis for equality with an arbitrary object. + * + * @param obj the object (<code>null</code> permitted). + * + * @return A boolean. + */ + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof ModuloAxis)) { + return false; + } + ModuloAxis that = (ModuloAxis) obj; + if (this.displayStart != that.displayStart) { + return false; + } + if (this.displayEnd != that.displayEnd) { + return false; + } + if (!this.fixedRange.equals(that.fixedRange)) { + return false; + } + return super.equals(obj); + } + } Modified: trunk/source/org/jfree/chart/axis/NumberAxis.java =================================================================== --- trunk/source/org/jfree/chart/axis/NumberAxis.java 2008-09-04 21:54:02 UTC (rev 1570) +++ trunk/source/org/jfree/chart/axis/NumberAxis.java 2008-09-04 21:54:58 UTC (rev 1571) @@ -32,8 +32,8 @@ * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): Laurence Vanhelsuwe; * - * Changes (from 18-Sep-2001) - * -------------------------- + * Changes + * ------- * 18-Sep-2001 : Added standard header and fixed DOS encoding problem (DG); * 22-Sep-2001 : Changed setMinimumAxisValue() and setMaximumAxisValue() so * that they clear the autoRange flag (DG); @@ -1237,7 +1237,6 @@ * @param edge the location of the axis. * * @return A list of ticks. - * */ protected List refreshTicksVertical(Graphics2D g2, Rectangle2D dataArea, @@ -1294,10 +1293,8 @@ } } - Tick tick = new NumberTick( - new Double(currentTickValue), tickLabel, anchor, - rotationAnchor, angle - ); + Tick tick = new NumberTick(new Double(currentTickValue), + tickLabel, anchor, rotationAnchor, angle); result.add(tick); } } Modified: trunk/source/org/jfree/chart/axis/PeriodAxis.java =================================================================== --- trunk/source/org/jfree/chart/axis/PeriodAxis.java 2008-09-04 21:54:02 UTC (rev 1570) +++ trunk/source/org/jfree/chart/axis/PeriodAxis.java 2008-09-04 21:54:58 UTC (rev 1571) @@ -51,6 +51,8 @@ * 20-Jun-2007 : Removed JCommon dependencies (DG); * 02-Jul-2007 : Added entity support for axis labels (DG); * 31-Jul-2007 : Fix for inverted axis labelling (see bug 1763413) (DG); + * 08-Apr-2008 : Notify listeners in setRange(Range, boolean, boolean) - fixes + * bug 1932146 (DG); * */ @@ -101,7 +103,7 @@ * the left or right of charts. */ public class PeriodAxis extends ValueAxis - implements Cloneable, PublicCloneable, Serializable { + implements Cloneable, PublicCloneable, Serializable { /** For serialization. */ private static final long serialVersionUID = 8353295532075872069L; @@ -203,6 +205,7 @@ this.first = first; this.last = last; this.timeZone = timeZone; + // FIXME: this calendar may need a locale as well this.calendar = Calendar.getInstance(timeZone); this.autoRangeTimePeriodClass = first.getClass(); this.majorTickTimePeriodClass = first.getClass(); @@ -285,6 +288,7 @@ throw new IllegalArgumentException("Null 'zone' argument."); } this.timeZone = zone; + // FIXME: this calendar may need a locale as well this.calendar = Calendar.getInstance(zone); notifyListeners(new AxisChangeEvent(this)); } @@ -484,13 +488,14 @@ } /** - * Sets the array of label info records. + * Sets the array of label info records and sends an + * {@link AxisChangeEvent} to all registered listeners. * * @param info the info. */ public void setLabelInfo(PeriodAxisLabelInfo[] info) { this.labelInfo = info; - // FIXME: shouldn't this generate an event? + notifyListeners(new AxisChangeEvent(this)); } /** @@ -524,6 +529,9 @@ new Date(lower), this.timeZone); this.last = createInstance(this.autoRangeTimePeriodClass, new Date(upper), this.timeZone); + if (notify) { + notifyListeners(new AxisChangeEvent(this)); + } } /** Modified: trunk/source/org/jfree/chart/axis/PeriodAxisLabelInfo.java =================================================================== --- trunk/source/org/jfree/chart/axis/PeriodAxisLabelInfo.java 2008-09-04 21:54:02 UTC (rev 1570) +++ trunk/source/org/jfree/chart/axis/PeriodAxisLabelInfo.java 2008-09-04 21:54:58 UTC (rev 1571) @@ -170,7 +170,8 @@ throw new IllegalArgumentException("Null 'labelPaint' argument."); } if (dividerStroke == null) { - throw new IllegalArgumentException("Null 'dividerStroke' argument."); + throw new IllegalArgumentException( + "Null 'dividerStroke' argument."); } if (dividerPaint == null) { throw new IllegalArgumentException("Null 'dividerPaint' argument."); @@ -271,11 +272,9 @@ RegularTimePeriod result = null; try { Constructor c = this.periodClass.getDeclaredConstructor( - new Class[] {Date.class, TimeZone.class} - ); - result = (RegularTimePeriod) c.newInstance( - new Object[] {millisecond, zone} - ); + new Class[] {Date.class, TimeZone.class}); + result = (RegularTimePeriod) c.newInstance(new Object[] { + millisecond, zone}); } catch (Exception e) { // do nothing Modified: trunk/source/org/jfree/chart/axis/QuarterDateFormat.java =================================================================== --- trunk/source/org/jfree/chart/axis/QuarterDateFormat.java 2008-09-04 21:54:02 UTC (rev 1570) +++ trunk/source/org/jfree/chart/axis/QuarterDateFormat.java 2008-09-04 21:54:58 UTC (rev 1571) @@ -61,7 +61,7 @@ * '2004 IV' for the last quarter of 2004. */ public class QuarterDateFormat extends DateFormat - implements Cloneable, Serializable { + implements Cloneable, Serializable { /** For serialization. */ private static final long serialVersionUID = -6738465248529797176L; Modified: trunk/source/org/jfree/chart/axis/SegmentedTimeline.java =================================================================== --- trunk/source/org/jfree/chart/axis/SegmentedTimeline.java 2008-09-04 21:54:02 UTC (rev 1570) +++ trunk/source/org/jfree/chart/axis/SegmentedTimeline.java 2008-09-04 21:54:58 UTC (rev 1571) @@ -557,25 +557,22 @@ if (baseTimeline != null) { if (baseTimeline.getSegmentSize() < this.segmentSize) { throw new IllegalArgumentException( - "baseTimeline.getSegmentSize() is smaller than segmentSize" - ); + "baseTimeline.getSegmentSize() " + + "is smaller than segmentSize"); } else if (baseTimeline.getStartTime() > this.startTime) { throw new IllegalArgumentException( - "baseTimeline.getStartTime() is after startTime" - ); + "baseTimeline.getStartTime() is after startTime"); } else if ((baseTimeline.getSegmentSize() % this.segmentSize) != 0) { throw new IllegalArgumentException( - "baseTimeline.getSegmentSize() is not multiple of " - + "segmentSize" - ); + "baseTimeline.getSegmentSize() is not multiple of " + + "segmentSize"); } else if (((this.startTime - baseTimeline.getStartTime()) % this.segmentSize) != 0) { throw new IllegalArgumentException( - "baseTimeline is not aligned" - ); + "baseTimeline is not aligned"); } } @@ -599,17 +596,17 @@ long groupIndex = rawMilliseconds / this.segmentsGroupSize; if (groupMilliseconds >= this.segmentsIncludedSize) { - result = toTimelineValue( - this.startTime + this.segmentsGroupSize * (groupIndex + 1) - ); + result = toTimelineValue(this.startTime + this.segmentsGroupSize + * (groupIndex + 1)); } else { Segment segment = getSegment(millisecond); if (segment.inExceptionSegments()) { - do { - segment = getSegment(millisecond = segment.getSegmentEnd() - + 1); - } while (segment.inExceptionSegments()); + int p; + while ((p = binarySearchExceptionSegments(segment)) >= 0) { + segment = getSegment(millisecond = ((Segment) + this.exceptionSegments.get(p)).getSegmentEnd() + 1); + } result = toTimelineValue(millisecond); } else { @@ -631,7 +628,7 @@ result = this.segmentsIncludedSize * y + x - wholeExceptionsBeforeDomainValue * this.segmentSize; - // - partialTimeInException;; + // - partialTimeInException; } else { result = this.segmentsIncludedSize * (y + 1) @@ -670,8 +667,8 @@ // calculate the result as if no exceptions Segment result = new Segment(this.startTime + timelineValue - + (timelineValue / this.segmentsIncludedSize) - * this.segmentsExcludedSize); + + (timelineValue / this.segmentsIncludedSize) + * this.segmentsExcludedSize); long lastIndex = this.startTime; @@ -727,10 +724,8 @@ this.workingCalendarNoDST.get(Calendar.MINUTE), this.workingCalendarNoDST.get(Calendar.SECOND) ); - this.workingCalendar.set( - Calendar.MILLISECOND, - this.workingCalendarNoDST.get(Calendar.MILLISECOND) - ); + this.workingCalendar.set(Calendar.MILLISECOND, + this.workingCalendarNoDST.get(Calendar.MILLISECOND)); // result = this.workingCalendar.getTimeInMillis(); // preceding code won't work with JDK 1.3 result = this.workingCalendar.getTime().getTime(); @@ -775,9 +770,8 @@ long domainValueEnd) { if (domainValueEnd < domainValueStart) { throw new IllegalArgumentException( - "domainValueEnd (" + domainValueEnd - + ") < domainValueStart (" + domainValueStart + ")" - ); + "domainValueEnd (" + domainValueEnd + + ") < domainValueStart (" + domainValueStart + ")"); } Segment segment = getSegment(domainValueStart); boolean contains = true; @@ -806,9 +800,8 @@ */ public boolean containsDomainRange(Date dateDomainValueStart, Date dateDomainValueEnd) { - return containsDomainRange( - getTime(dateDomainValueStart), getTime(dateDomainValueEnd) - ); + return containsDomainRange(getTime(dateDomainValueStart), + getTime(dateDomainValueEnd)); } /** @@ -1006,8 +999,7 @@ // add the interval as an exception addException(new BaseTimelineSegmentRange( - fromDomainValue, toDomainValue - )); + fromDomainValue, toDomainValue)); } else { // this is not one of our included segment, skip it @@ -1039,8 +1031,8 @@ for (Iterator iter = this.exceptionSegments.iterator(); iter.hasNext();) { Segment segment = (Segment) iter.next(); - Segment intersection - = segment.intersect(fromMillisecond, toMillisecond); + Segment intersection = segment.intersect(fromMillisecond, + toMillisecond); if (intersection != null) { n += intersection.getSegmentCount(); } @@ -1111,9 +1103,8 @@ boolean b1 = (this.segmentsIncluded == other.getSegmentsIncluded()); boolean b2 = (this.segmentsExcluded == other.getSegmentsExcluded()); boolean b3 = (this.startTime == other.getStartTime()); - boolean b4 = equals( - this.exceptionSegments, other.getExceptionSegments() - ); + boolean b4 = equals(this.exceptionSegments, + other.getExceptionSegments()); return b0 && b1 && b2 && b3 && b4; } else { @@ -1190,17 +1181,14 @@ if (this.adjustForDaylightSaving) { this.workingCalendar.setTime(date); this.workingCalendarNoDST.set( - this.workingCalendar.get(Calendar.YEAR), - this.workingCalendar.get(Calendar.MONTH), - this.workingCalendar.get(Calendar.DATE), - this.workingCalendar.get(Calendar.HOUR_OF_DAY), - this.workingCalendar.get(Calendar.MINUTE), - this.workingCalendar.get(Calendar.SECOND) - ); - this.workingCalendarNoDST.set( - Calendar.MILLISECOND, - this.workingCalendar.get(Calendar.MILLISECOND) - ); + this.workingCalendar.get(Calendar.YEAR), + this.workingCalendar.get(Calendar.MONTH), + this.workingCalendar.get(Calendar.DATE), + this.workingCalendar.get(Calendar.HOUR_OF_DAY), + this.workingCalendar.get(Calendar.MINUTE), + this.workingCalendar.get(Calendar.SECOND)); + this.workingCalendarNoDST.set(Calendar.MILLISECOND, + this.workingCalendar.get(Calendar.MILLISECOND)); Date revisedDate = this.workingCalendarNoDST.getTime(); result = revisedDate.getTime(); } @@ -1526,7 +1514,7 @@ */ public boolean inExcludeSegments() { return getSegmentNumberRelativeToGroup() - >= SegmentedTimeline.this.segmentsIncluded; + >= SegmentedTimeline.this.segmentsIncluded; } /** @@ -1736,8 +1724,7 @@ */ public void inc(long n) { throw new IllegalArgumentException( - "Not implemented in SegmentRange" - ); + "Not implemented in SegmentRange"); } } Modified: trunk/source/org/jfree/chart/axis/ValueAxis.java =================================================================== --- trunk/source/org/jfree/chart/axis/ValueAxis.java 2008-09-04 21:54:02 UTC (rev 1570) +++ trunk/source/org/jfree/chart/axis/ValueAxis.java 2008-09-04 21:54:58 UTC (rev 1571) @@ -34,8 +34,8 @@ * Nicolas Brodu (for Astrium and EADS Corporate Research * Center); * - * Changes (from 18-Sep-2001) - * -------------------------- + * Changes + * ------- * 18-Sep-2001 : Added standard header and fixed DOS encoding problem (DG); * 23-Nov-2001 : Overhauled standard tick unit code (DG); * 04-Dec-2001 : Changed constructors to protected, and tidied up default @@ -137,8 +137,7 @@ * {@link DateAxis} and {@link NumberAxis}. */ public abstract class ValueAxis extends Axis - implements Cloneable, PublicCloneable, - Serializable { + implements Cloneable, PublicCloneable, Serializable { /** For serialization. */ private static final long serialVersionUID = 3698345477322391456L; @@ -683,7 +682,8 @@ tick.getAngle(), tick.getRotationAnchor()); } - if (isTickMarksVisible() && tick.getTickType().equals(TickType.MAJOR)) { + if (isTickMarksVisible() && tick.getTickType().equals( + TickType.MAJOR)) { float xx = (float) valueToJava2D(tick.getValue(), dataArea, edge); Line2D mark = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |