1 27 28 package nextapp.echo2.app; 29 30 import java.io.Serializable ; 31 32 46 public class FillImageBorder 47 implements Serializable { 48 49 public static final int TOP_LEFT = 0; 50 public static final int TOP = 1; 51 public static final int TOP_RIGHT= 2; 52 public static final int LEFT = 3; 53 public static final int RIGHT = 4; 54 public static final int BOTTOM_LEFT= 5; 55 public static final int BOTTOM = 6; 56 public static final int BOTTOM_RIGHT = 7; 57 58 private Insets contentInsets, borderInsets; 59 private Color color; 60 private FillImage[] fillImages; 61 62 65 public FillImageBorder() { 66 super(); 67 } 68 69 80 public FillImageBorder(Color color, Insets borderInsets, Insets contentInsets) { 81 super(); 82 this.color = color; 83 this.borderInsets = borderInsets; 84 this.contentInsets = contentInsets; 85 } 86 87 90 public boolean equals(Object o) { 91 if (!(o instanceof FillImageBorder)) { 92 return false; 93 } 94 FillImageBorder that = (FillImageBorder) o; 95 if (!(this.color == that.color || 96 (this.color != null && this.color.equals(that.color)))) { 97 return false; 98 } 99 if (!(this.borderInsets == that.borderInsets || 100 (this.borderInsets != null && this.borderInsets.equals(that.borderInsets)))) { 101 return false; 102 } 103 if (!(this.contentInsets == that.contentInsets || 104 (this.contentInsets != null && this.contentInsets.equals(that.contentInsets)))) { 105 return false; 106 } 107 if (this.fillImages != null || that.fillImages != null) { 108 if (this.fillImages == null || that.fillImages == null) { 109 return false; 110 } 111 for (int i = 0; i < fillImages.length; ++i) { 112 if (!(this.fillImages[i] == that.fillImages[i] || 113 (this.fillImages[i] != null && this.fillImages[i].equals(that.fillImages[i])))) { 114 return false; 115 } 116 } 117 } 118 return true; 119 } 120 121 127 public Insets getBorderInsets() { 128 return borderInsets; 129 } 130 131 137 public Color getColor() { 138 return color; 139 } 140 141 147 public Insets getContentInsets() { 148 return contentInsets; 149 } 150 151 167 public FillImage getFillImage(int position) { 168 if (fillImages == null) { 169 return null; 170 } else { 171 return fillImages[position]; 172 } 173 } 174 175 183 public void setBorderInsets(Insets borderInsets) { 184 this.borderInsets = borderInsets; 185 } 186 187 195 public void setColor(Color color) { 196 this.color = color; 197 } 198 199 210 public void setContentInsets(Insets contentInsets) { 211 this.contentInsets = contentInsets; 212 } 213 214 230 public void setFillImage(int position, FillImage fillImage) { 231 if (fillImages == null) { 232 if (fillImage == null) { 233 return; 234 } 235 fillImages = new FillImage[8]; 236 } 237 fillImages[position] = fillImage; 238 } 239 } | Popular Tags |