1 19 20 package jxl.write; 21 22 import jxl.biff.DisplayFormat; 23 24 27 public final class DateFormats 28 { 29 32 private static class BuiltInFormat implements DisplayFormat 33 { 34 37 private int index; 38 41 private String formatString; 42 43 49 public BuiltInFormat(int i, String s) 50 { 51 index = i; 52 formatString = s; 53 } 54 55 60 public int getFormatIndex() 61 { 62 return index; 63 } 64 65 71 public boolean isInitialized() 72 { 73 return true; 74 } 75 82 public void initialize(int pos) 83 { 84 } 85 90 public boolean isBuiltIn() 91 { 92 return true; 93 } 94 101 public String getFormatString() 102 { 103 return formatString; 104 } 105 106 112 public boolean equals(Object o) 113 { 114 if (o == this) 115 { 116 return true; 117 } 118 119 if (!(o instanceof BuiltInFormat)) 120 { 121 return false; 122 } 123 124 BuiltInFormat bif = (BuiltInFormat) o; 125 126 return index == bif.index; 127 } 128 129 134 public int hashCode() 135 { 136 return index; 137 } 138 } 139 140 142 145 public static final DisplayFormat FORMAT1 = 146 new BuiltInFormat(0x0e, "M/d/yy"); 147 150 public static final DisplayFormat DEFAULT = FORMAT1; 151 152 155 public static final DisplayFormat FORMAT2 = 156 new BuiltInFormat(0xf, "d-MMM-yy"); 157 158 161 public static final DisplayFormat FORMAT3 = 162 new BuiltInFormat(0x10, "d-MMM"); 163 164 167 public static final DisplayFormat FORMAT4 = 168 new BuiltInFormat(0x11, "MMM-yy"); 169 170 173 public static final DisplayFormat FORMAT5 = 174 new BuiltInFormat(0x12, "h:mm a"); 175 176 179 public static final DisplayFormat FORMAT6 = 180 new BuiltInFormat(0x13, "h:mm:ss a"); 181 182 185 public static final DisplayFormat FORMAT7 = 186 new BuiltInFormat(0x14, "H:mm"); 187 188 191 public static final DisplayFormat FORMAT8 = 192 new BuiltInFormat(0x15, "H:mm:ss"); 193 194 197 public static final DisplayFormat FORMAT9 = 198 new BuiltInFormat(0x16, "M/d/yy H:mm"); 199 200 203 public static final DisplayFormat FORMAT10 = 204 new BuiltInFormat(0x2d, "mm:ss"); 205 206 209 public static final DisplayFormat FORMAT11 = 210 new BuiltInFormat(0x2e, "H:mm:ss"); 211 212 215 public static final DisplayFormat FORMAT12 = 216 new BuiltInFormat(0x2f, "H:mm:ss"); 217 } 218 219 220 221 | Popular Tags |