1 46 47 package org.jfree.chart.plot; 48 49 import java.awt.BasicStroke ; 50 import java.awt.Color ; 51 import java.awt.Paint ; 52 import java.awt.Stroke ; 53 import java.io.Serializable ; 54 55 import org.jfree.chart.event.MarkerChangeEvent; 56 import org.jfree.ui.GradientPaintTransformer; 57 import org.jfree.ui.LengthAdjustmentType; 58 import org.jfree.util.ObjectUtilities; 59 60 63 public class IntervalMarker extends Marker implements Cloneable , Serializable { 64 65 66 private static final long serialVersionUID = -1762344775267627916L; 67 68 69 private double startValue; 70 71 72 private double endValue; 73 74 75 private GradientPaintTransformer gradientPaintTransformer; 76 77 83 public IntervalMarker(double start, double end) { 84 this(start, end, Color.gray, new BasicStroke (0.5f), Color.gray, 85 new BasicStroke (0.5f), 0.8f); 86 } 87 88 99 public IntervalMarker(double start, double end, 100 Paint paint, Stroke stroke, 101 Paint outlinePaint, Stroke outlineStroke, 102 float alpha) { 103 104 super(paint, stroke, outlinePaint, outlineStroke, alpha); 105 this.startValue = start; 106 this.endValue = end; 107 this.gradientPaintTransformer = null; 108 setLabelOffsetType(LengthAdjustmentType.CONTRACT); 109 110 } 111 112 117 public double getStartValue() { 118 return this.startValue; 119 } 120 121 129 public void setStartValue(double value) { 130 this.startValue = value; 131 notifyListeners(new MarkerChangeEvent(this)); 132 } 133 134 139 public double getEndValue() { 140 return this.endValue; 141 } 142 143 151 public void setEndValue(double value) { 152 this.endValue = value; 153 notifyListeners(new MarkerChangeEvent(this)); 154 } 155 156 161 public GradientPaintTransformer getGradientPaintTransformer() { 162 return this.gradientPaintTransformer; 163 } 164 165 171 public void setGradientPaintTransformer( 172 GradientPaintTransformer transformer) { 173 this.gradientPaintTransformer = transformer; 174 notifyListeners(new MarkerChangeEvent(this)); 175 } 176 177 184 public boolean equals(Object obj) { 185 if (obj == this) { 186 return true; 187 } 188 if (!(obj instanceof IntervalMarker)) { 189 return false; 190 } 191 if (!super.equals(obj)) { 192 return false; 193 } 194 IntervalMarker that = (IntervalMarker) obj; 195 if (this.startValue != that.startValue) { 196 return false; 197 } 198 if (this.endValue != that.endValue) { 199 return false; 200 } 201 if (!ObjectUtilities.equal(this.gradientPaintTransformer, 202 that.gradientPaintTransformer)) { 203 return false; 204 } 205 return true; 206 } 207 208 216 public Object clone() throws CloneNotSupportedException { 217 return super.clone(); 218 } 219 220 } 221 | Popular Tags |