1 37 package org.jfree.chart.renderer; 38 39 import java.io.Serializable ; 40 41 47 public class ItemLabelAnchor implements Serializable { 48 49 50 public static final ItemLabelAnchor CENTER = new ItemLabelAnchor("ItemLabelAnchor.CENTER"); 51 52 53 public static final ItemLabelAnchor INSIDE1 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE1"); 54 55 56 public static final ItemLabelAnchor INSIDE2 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE2"); 57 58 59 public static final ItemLabelAnchor INSIDE3 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE3"); 60 61 62 public static final ItemLabelAnchor INSIDE4 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE4"); 63 64 65 public static final ItemLabelAnchor INSIDE5 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE5"); 66 67 68 public static final ItemLabelAnchor INSIDE6 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE6"); 69 70 71 public static final ItemLabelAnchor INSIDE7 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE7"); 72 73 74 public static final ItemLabelAnchor INSIDE8 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE8"); 75 76 77 public static final ItemLabelAnchor INSIDE9 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE9"); 78 79 80 public static final ItemLabelAnchor INSIDE10 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE10"); 81 82 83 public static final ItemLabelAnchor INSIDE11 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE11"); 84 85 86 public static final ItemLabelAnchor INSIDE12 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE12"); 87 88 89 public static final ItemLabelAnchor OUTSIDE1 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE1"); 90 91 92 public static final ItemLabelAnchor OUTSIDE2 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE2"); 93 94 95 public static final ItemLabelAnchor OUTSIDE3 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE3"); 96 97 98 public static final ItemLabelAnchor OUTSIDE4 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE4"); 99 100 101 public static final ItemLabelAnchor OUTSIDE5 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE5"); 102 103 104 public static final ItemLabelAnchor OUTSIDE6 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE6"); 105 106 107 public static final ItemLabelAnchor OUTSIDE7 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE7"); 108 109 110 public static final ItemLabelAnchor OUTSIDE8 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE8"); 111 112 113 public static final ItemLabelAnchor OUTSIDE9 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE9"); 114 115 116 public static final ItemLabelAnchor OUTSIDE10 117 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE10"); 118 119 120 public static final ItemLabelAnchor OUTSIDE11 121 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE11"); 122 123 124 public static final ItemLabelAnchor OUTSIDE12 125 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE12"); 126 127 128 private String name; 129 130 135 private ItemLabelAnchor(String name) { 136 this.name = name; 137 } 138 139 144 public String toString() { 145 return this.name; 146 } 147 148 156 public boolean equals(Object o) { 157 158 if (this == o) { 159 return true; 160 } 161 if (!(o instanceof ItemLabelAnchor)) { 162 return false; 163 } 164 165 final ItemLabelAnchor order = (ItemLabelAnchor) o; 166 if (!this.name.equals(order.toString())) { 167 return false; 168 } 169 170 return true; 171 172 } 173 174 183 public static ItemLabelAnchor getHorizontalOpposite(ItemLabelAnchor anchor) { 184 185 if (anchor == ItemLabelAnchor.CENTER) { 186 return ItemLabelAnchor.CENTER; 187 } 188 else if (anchor == ItemLabelAnchor.INSIDE1) { 189 return ItemLabelAnchor.INSIDE11; 190 } 191 else if (anchor == ItemLabelAnchor.INSIDE2) { 192 return ItemLabelAnchor.INSIDE10; 193 } 194 else if (anchor == ItemLabelAnchor.INSIDE3) { 195 return ItemLabelAnchor.INSIDE9; 196 } 197 else if (anchor == ItemLabelAnchor.INSIDE4) { 198 return ItemLabelAnchor.INSIDE8; 199 } 200 else if (anchor == ItemLabelAnchor.INSIDE5) { 201 return ItemLabelAnchor.INSIDE7; 202 } 203 else if (anchor == ItemLabelAnchor.INSIDE6) { 204 return ItemLabelAnchor.INSIDE6; 205 } 206 else if (anchor == ItemLabelAnchor.INSIDE7) { 207 return ItemLabelAnchor.INSIDE5; 208 } 209 else if (anchor == ItemLabelAnchor.INSIDE8) { 210 return ItemLabelAnchor.INSIDE4; 211 } 212 else if (anchor == ItemLabelAnchor.INSIDE9) { 213 return ItemLabelAnchor.INSIDE3; 214 } 215 else if (anchor == ItemLabelAnchor.INSIDE10) { 216 return ItemLabelAnchor.INSIDE2; 217 } 218 else if (anchor == ItemLabelAnchor.INSIDE11) { 219 return ItemLabelAnchor.INSIDE1; 220 } 221 else if (anchor == ItemLabelAnchor.INSIDE12) { 222 return ItemLabelAnchor.INSIDE12; 223 } 224 else if (anchor == ItemLabelAnchor.OUTSIDE1) { 225 return ItemLabelAnchor.OUTSIDE11; 226 } 227 else if (anchor == ItemLabelAnchor.OUTSIDE2) { 228 return ItemLabelAnchor.OUTSIDE10; 229 } 230 else if (anchor == ItemLabelAnchor.OUTSIDE3) { 231 return ItemLabelAnchor.OUTSIDE9; 232 } 233 else if (anchor == ItemLabelAnchor.OUTSIDE4) { 234 return ItemLabelAnchor.OUTSIDE8; 235 } 236 else if (anchor == ItemLabelAnchor.OUTSIDE5) { 237 return ItemLabelAnchor.OUTSIDE7; 238 } 239 else if (anchor == ItemLabelAnchor.OUTSIDE6) { 240 return ItemLabelAnchor.OUTSIDE6; 241 } 242 else if (anchor == ItemLabelAnchor.OUTSIDE7) { 243 return ItemLabelAnchor.OUTSIDE5; 244 } 245 else if (anchor == ItemLabelAnchor.OUTSIDE8) { 246 return ItemLabelAnchor.OUTSIDE4; 247 } 248 else if (anchor == ItemLabelAnchor.OUTSIDE9) { 249 return ItemLabelAnchor.OUTSIDE3; 250 } 251 else if (anchor == ItemLabelAnchor.OUTSIDE10) { 252 return ItemLabelAnchor.OUTSIDE2; 253 } 254 else if (anchor == ItemLabelAnchor.OUTSIDE11) { 255 return ItemLabelAnchor.OUTSIDE1; 256 } 257 else if (anchor == ItemLabelAnchor.OUTSIDE12) { 258 return ItemLabelAnchor.OUTSIDE12; 259 } 260 return null; 261 } 262 263 272 public static ItemLabelAnchor getVerticalOpposite(ItemLabelAnchor anchor) { 273 274 if (anchor == ItemLabelAnchor.CENTER) { 275 return ItemLabelAnchor.CENTER; 276 } 277 else if (anchor == ItemLabelAnchor.INSIDE1) { 278 return ItemLabelAnchor.INSIDE5; 279 } 280 else if (anchor == ItemLabelAnchor.INSIDE2) { 281 return ItemLabelAnchor.INSIDE4; 282 } 283 else if (anchor == ItemLabelAnchor.INSIDE3) { 284 return ItemLabelAnchor.INSIDE3; 285 } 286 else if (anchor == ItemLabelAnchor.INSIDE4) { 287 return ItemLabelAnchor.INSIDE2; 288 } 289 else if (anchor == ItemLabelAnchor.INSIDE5) { 290 return ItemLabelAnchor.INSIDE1; 291 } 292 else if (anchor == ItemLabelAnchor.INSIDE6) { 293 return ItemLabelAnchor.INSIDE12; 294 } 295 else if (anchor == ItemLabelAnchor.INSIDE7) { 296 return ItemLabelAnchor.INSIDE11; 297 } 298 else if (anchor == ItemLabelAnchor.INSIDE8) { 299 return ItemLabelAnchor.INSIDE10; 300 } 301 else if (anchor == ItemLabelAnchor.INSIDE9) { 302 return ItemLabelAnchor.INSIDE9; 303 } 304 else if (anchor == ItemLabelAnchor.INSIDE10) { 305 return ItemLabelAnchor.INSIDE8; 306 } 307 else if (anchor == ItemLabelAnchor.INSIDE11) { 308 return ItemLabelAnchor.INSIDE7; 309 } 310 else if (anchor == ItemLabelAnchor.INSIDE12) { 311 return ItemLabelAnchor.INSIDE6; 312 } 313 else if (anchor == ItemLabelAnchor.OUTSIDE1) { 314 return ItemLabelAnchor.OUTSIDE5; 315 } 316 else if (anchor == ItemLabelAnchor.OUTSIDE2) { 317 return ItemLabelAnchor.OUTSIDE4; 318 } 319 else if (anchor == ItemLabelAnchor.OUTSIDE3) { 320 return ItemLabelAnchor.OUTSIDE3; 321 } 322 else if (anchor == ItemLabelAnchor.OUTSIDE4) { 323 return ItemLabelAnchor.OUTSIDE2; 324 } 325 else if (anchor == ItemLabelAnchor.OUTSIDE5) { 326 return ItemLabelAnchor.OUTSIDE1; 327 } 328 else if (anchor == ItemLabelAnchor.OUTSIDE6) { 329 return ItemLabelAnchor.OUTSIDE12; 330 } 331 else if (anchor == ItemLabelAnchor.OUTSIDE7) { 332 return ItemLabelAnchor.OUTSIDE11; 333 } 334 else if (anchor == ItemLabelAnchor.OUTSIDE8) { 335 return ItemLabelAnchor.OUTSIDE10; 336 } 337 else if (anchor == ItemLabelAnchor.OUTSIDE9) { 338 return ItemLabelAnchor.OUTSIDE9; 339 } 340 else if (anchor == ItemLabelAnchor.OUTSIDE10) { 341 return ItemLabelAnchor.OUTSIDE8; 342 } 343 else if (anchor == ItemLabelAnchor.OUTSIDE11) { 344 return ItemLabelAnchor.OUTSIDE7; 345 } 346 else if (anchor == ItemLabelAnchor.OUTSIDE12) { 347 return ItemLabelAnchor.OUTSIDE6; 348 } 349 return null; 350 } 351 352 } 353 | Popular Tags |