1 43 44 package org.jfree.ui; 45 46 import java.io.ObjectStreamException ; 47 import java.io.Serializable ; 48 49 55 public final class TextAnchor implements Serializable { 56 57 58 private static final long serialVersionUID = 8219158940496719660L; 59 60 61 public static final TextAnchor TOP_LEFT 62 = new TextAnchor("TextAnchor.TOP_LEFT"); 63 64 65 public static final TextAnchor TOP_CENTER 66 = new TextAnchor("TextAnchor.TOP_CENTER"); 67 68 69 public static final TextAnchor TOP_RIGHT 70 = new TextAnchor("TextAnchor.TOP_RIGHT"); 71 72 73 public static final TextAnchor HALF_ASCENT_LEFT 74 = new TextAnchor("TextAnchor.HALF_ASCENT_LEFT"); 75 76 77 public static final TextAnchor HALF_ASCENT_CENTER 78 = new TextAnchor("TextAnchor.HALF_ASCENT_CENTER"); 79 80 81 public static final TextAnchor HALF_ASCENT_RIGHT 82 = new TextAnchor("TextAnchor.HALF_ASCENT_RIGHT"); 83 84 85 public static final TextAnchor CENTER_LEFT 86 = new TextAnchor("TextAnchor.CENTER_LEFT"); 87 88 89 public static final TextAnchor CENTER = new TextAnchor("TextAnchor.CENTER"); 90 91 92 public static final TextAnchor CENTER_RIGHT 93 = new TextAnchor("TextAnchor.CENTER_RIGHT"); 94 95 96 public static final TextAnchor BASELINE_LEFT 97 = new TextAnchor("TextAnchor.BASELINE_LEFT"); 98 99 100 public static final TextAnchor BASELINE_CENTER 101 = new TextAnchor("TextAnchor.BASELINE_CENTER"); 102 103 104 public static final TextAnchor BASELINE_RIGHT 105 = new TextAnchor("TextAnchor.BASELINE_RIGHT"); 106 107 108 public static final TextAnchor BOTTOM_LEFT 109 = new TextAnchor("TextAnchor.BOTTOM_LEFT"); 110 111 112 public static final TextAnchor BOTTOM_CENTER 113 = new TextAnchor("TextAnchor.BOTTOM_CENTER"); 114 115 116 public static final TextAnchor BOTTOM_RIGHT 117 = new TextAnchor("TextAnchor.BOTTOM_RIGHT"); 118 119 120 private String name; 121 122 127 private TextAnchor(final String name) { 128 this.name = name; 129 } 130 131 136 public String toString() { 137 return this.name; 138 } 139 140 148 public boolean equals(final Object o) { 149 150 if (this == o) { 151 return true; 152 } 153 if (!(o instanceof TextAnchor)) { 154 return false; 155 } 156 157 final TextAnchor order = (TextAnchor) o; 158 if (!this.name.equals(order.name)) { 159 return false; 160 } 161 162 return true; 163 } 164 165 170 public int hashCode() { 171 return this.name.hashCode(); 172 } 173 174 181 private Object readResolve() throws ObjectStreamException { 182 TextAnchor result = null; 183 if (this.equals(TextAnchor.TOP_LEFT)) { 184 result = TextAnchor.TOP_LEFT; 185 } 186 else if (this.equals(TextAnchor.TOP_CENTER)) { 187 result = TextAnchor.TOP_CENTER; 188 } 189 else if (this.equals(TextAnchor.TOP_RIGHT)) { 190 result = TextAnchor.TOP_RIGHT; 191 } 192 else if (this.equals(TextAnchor.BOTTOM_LEFT)) { 193 result = TextAnchor.BOTTOM_LEFT; 194 } 195 else if (this.equals(TextAnchor.BOTTOM_CENTER)) { 196 result = TextAnchor.BOTTOM_CENTER; 197 } 198 else if (this.equals(TextAnchor.BOTTOM_RIGHT)) { 199 result = TextAnchor.BOTTOM_RIGHT; 200 } 201 else if (this.equals(TextAnchor.BASELINE_LEFT)) { 202 result = TextAnchor.BASELINE_LEFT; 203 } 204 else if (this.equals(TextAnchor.BASELINE_CENTER)) { 205 result = TextAnchor.BASELINE_CENTER; 206 } 207 else if (this.equals(TextAnchor.BASELINE_RIGHT)) { 208 result = TextAnchor.BASELINE_RIGHT; 209 } 210 else if (this.equals(TextAnchor.CENTER_LEFT)) { 211 result = TextAnchor.CENTER_LEFT; 212 } 213 else if (this.equals(TextAnchor.CENTER)) { 214 result = TextAnchor.CENTER; 215 } 216 else if (this.equals(TextAnchor.CENTER_RIGHT)) { 217 result = TextAnchor.CENTER_RIGHT; 218 } 219 else if (this.equals(TextAnchor.HALF_ASCENT_LEFT)) { 220 result = TextAnchor.HALF_ASCENT_LEFT; 221 } 222 else if (this.equals(TextAnchor.HALF_ASCENT_CENTER)) { 223 result = TextAnchor.HALF_ASCENT_CENTER; 224 } 225 else if (this.equals(TextAnchor.HALF_ASCENT_RIGHT)) { 226 result = TextAnchor.HALF_ASCENT_RIGHT; 227 } 228 return result; 229 } 230 231 } 232 | Popular Tags |