1 45 46 package org.jfree.chart.labels; 47 48 import java.io.Serializable ; 49 50 import org.jfree.ui.TextAnchor; 51 52 56 public class ItemLabelPosition implements Serializable { 57 58 59 private static final long serialVersionUID = 5845390630157034499L; 60 61 62 private ItemLabelAnchor itemLabelAnchor; 63 64 65 private TextAnchor textAnchor; 66 67 68 private TextAnchor rotationAnchor; 69 70 71 private double angle; 72 73 76 public ItemLabelPosition() { 77 this( 78 ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER, 79 TextAnchor.CENTER, 0.0 80 ); 81 } 82 83 90 public ItemLabelPosition(ItemLabelAnchor itemLabelAnchor, 91 TextAnchor textAnchor) { 92 this(itemLabelAnchor, textAnchor, TextAnchor.CENTER, 0.0); 93 } 94 95 108 public ItemLabelPosition(ItemLabelAnchor itemLabelAnchor, 109 TextAnchor textAnchor, 110 TextAnchor rotationAnchor, 111 double angle) { 112 113 if (itemLabelAnchor == null) { 114 throw new IllegalArgumentException ( 115 "Null 'itemLabelAnchor' argument." 116 ); 117 } 118 if (textAnchor == null) { 119 throw new IllegalArgumentException ("Null 'textAnchor' argument."); 120 } 121 if (rotationAnchor == null) { 122 throw new IllegalArgumentException ( 123 "Null 'rotationAnchor' argument." 124 ); 125 } 126 127 this.itemLabelAnchor = itemLabelAnchor; 128 this.textAnchor = textAnchor; 129 this.rotationAnchor = rotationAnchor; 130 this.angle = angle; 131 132 } 133 134 139 public ItemLabelAnchor getItemLabelAnchor() { 140 return this.itemLabelAnchor; 141 } 142 143 148 public TextAnchor getTextAnchor() { 149 return this.textAnchor; 150 } 151 152 157 public TextAnchor getRotationAnchor() { 158 return this.rotationAnchor; 159 } 160 161 166 public double getAngle() { 167 return this.angle; 168 } 169 170 177 public boolean equals(Object obj) { 178 if (obj == this) { 179 return true; 180 } 181 if (!(obj instanceof ItemLabelPosition)) { 182 return false; 183 } 184 ItemLabelPosition that = (ItemLabelPosition) obj; 185 if (!this.itemLabelAnchor.equals(that.itemLabelAnchor)) { 186 return false; 187 } 188 if (!this.textAnchor.equals(that.textAnchor)) { 189 return false; 190 } 191 if (!this.rotationAnchor.equals(that.rotationAnchor)) { 192 return false; 193 } 194 if (this.angle != that.angle) { 195 return false; 196 } 197 return true; 198 } 199 200 } 201 | Popular Tags |