1 42 43 package org.jfree.ui; 44 45 import java.io.ObjectStreamException ; 46 import java.io.Serializable ; 47 48 53 public final class GradientPaintTransformType implements Serializable { 54 55 56 private static final long serialVersionUID = 8331561784933982450L; 57 58 59 public static final GradientPaintTransformType VERTICAL 60 = new GradientPaintTransformType("GradientPaintTransformType.VERTICAL"); 61 62 63 public static final GradientPaintTransformType HORIZONTAL 64 = new GradientPaintTransformType( 65 "GradientPaintTransformType.HORIZONTAL"); 66 67 68 public static final GradientPaintTransformType CENTER_VERTICAL 69 = new GradientPaintTransformType( 70 "GradientPaintTransformType.CENTER_VERTICAL"); 71 72 73 public static final GradientPaintTransformType CENTER_HORIZONTAL 74 = new GradientPaintTransformType( 75 "GradientPaintTransformType.CENTER_HORIZONTAL"); 76 77 78 private String name; 79 80 85 private GradientPaintTransformType(final String name) { 86 this.name = name; 87 } 88 89 94 public String toString() { 95 return this.name; 96 } 97 98 106 public boolean equals(final Object o) { 107 108 if (this == o) { 109 return true; 110 } 111 if (!(o instanceof GradientPaintTransformType)) { 112 return false; 113 } 114 115 final GradientPaintTransformType t = (GradientPaintTransformType) o; 116 if (!this.name.equals(t.name)) { 117 return false; 118 } 119 120 return true; 121 } 122 123 128 public int hashCode() { 129 return this.name.hashCode(); 130 } 131 132 139 private Object readResolve() throws ObjectStreamException { 140 GradientPaintTransformType result = null; 141 if (this.equals(GradientPaintTransformType.HORIZONTAL)) { 142 result = GradientPaintTransformType.HORIZONTAL; 143 } 144 else if (this.equals(GradientPaintTransformType.VERTICAL)) { 145 result = GradientPaintTransformType.VERTICAL; 146 } 147 else if (this.equals(GradientPaintTransformType.CENTER_HORIZONTAL)) { 148 result = GradientPaintTransformType.CENTER_HORIZONTAL; 149 } 150 else if (this.equals(GradientPaintTransformType.CENTER_VERTICAL)) { 151 result = GradientPaintTransformType.CENTER_VERTICAL; 152 } 153 return result; 154 } 155 156 } 157 158 | Popular Tags |