1:
37:
38: package ;
39:
40: import ;
41: import ;
42:
43:
50: public class CSS implements Serializable
51: {
52:
57: public static CSS.Attribute[] getAllAttributeKeys()
58: {
59: Object[] src = Attribute.attributeMap.values().toArray();
60: CSS.Attribute[] dst = new CSS.Attribute[ src.length ];
61: System.arraycopy(src, 0, dst, 0, src.length);
62: return dst;
63: }
64:
65:
72: public static CSS.Attribute getAttribute(String name)
73: {
74: return (CSS.Attribute)Attribute.attributeMap.get( name );
75: }
76:
77: public static final class Attribute
78: {
79:
82: public static final Attribute BACKGROUND =
83: new Attribute("background", false, null);
84:
85:
88: public static final Attribute BACKGROUND_ATTACHMENT =
89: new Attribute("background-attachment", false, "scroll");
90:
91:
94: public static final Attribute BACKGROUND_COLOR =
95: new Attribute("background-color", false, "transparent");
96:
97:
100: public static final Attribute BACKGROUND_IMAGE =
101: new Attribute("background-image", false, "none");
102:
103:
106: public static final Attribute BACKGROUND_POSITION =
107: new Attribute("background-position", false, null);
108:
109:
112: public static final Attribute BACKGROUND_REPEAT =
113: new Attribute("background-repeat", false, "repeat");
114:
115:
118: public static final Attribute BORDER = new Attribute("border", false, null);
119:
120:
123: public static final Attribute BORDER_BOTTOM =
124: new Attribute("border-bottom", false, null);
125:
126:
129: public static final Attribute BORDER_BOTTOM_WIDTH =
130: new Attribute("border-bottom-width", false, "medium");
131:
132:
135: public static final Attribute BORDER_COLOR =
136: new Attribute("border-color", false, "black");
137:
138:
141: public static final Attribute BORDER_LEFT =
142: new Attribute("border-left", false, null);
143:
144:
147: public static final Attribute BORDER_LEFT_WIDTH =
148: new Attribute("border-left-width", false, "medium");
149:
150:
153: public static final Attribute BORDER_RIGHT =
154: new Attribute("border-right", false, null);
155:
156:
159: public static final Attribute BORDER_RIGHT_WIDTH =
160: new Attribute("border-right-width", false, "medium");
161:
162:
165: public static final Attribute BORDER_STYLE =
166: new Attribute("border-style", false, "none");
167:
168:
171: public static final Attribute BORDER_TOP =
172: new Attribute("border-top", false, null);
173:
174:
177: public static final Attribute BORDER_TOP_WIDTH =
178: new Attribute("border-top-width", false, "medium");
179:
180:
183: public static final Attribute BORDER_WIDTH =
184: new Attribute("border-width", false, "medium");
185:
186:
189: public static final Attribute CLEAR = new Attribute("clear", false, "none");
190:
191:
194: public static final Attribute COLOR = new Attribute("color", true, "black");
195:
196:
199: public static final Attribute DISPLAY =
200: new Attribute("display", false, "block");
201:
202:
205: public static final Attribute FLOAT = new Attribute("float", false, "none");
206:
207:
210: public static final Attribute FONT = new Attribute("font", true, null);
211:
212:
215: public static final Attribute FONT_FAMILY =
216: new Attribute("font-family", true, null);
217:
218:
221: public static final Attribute FONT_SIZE =
222: new Attribute("font-size", true, "medium");
223:
224:
227: public static final Attribute FONT_STYLE =
228: new Attribute("font-style", true, "normal");
229:
230:
233: public static final Attribute FONT_VARIANT =
234: new Attribute("font-variant", true, "normal");
235:
236:
239: public static final Attribute FONT_WEIGHT =
240: new Attribute("font-weight", true, "normal");
241:
242:
245: public static final Attribute HEIGHT =
246: new Attribute("height", false, "auto");
247:
248:
251: public static final Attribute LETTER_SPACING =
252: new Attribute("letter-spacing", true, "normal");
253:
254:
257: public static final Attribute LINE_HEIGHT =
258: new Attribute("line-height", true, "normal");
259:
260:
263: public static final Attribute LIST_STYLE =
264: new Attribute("list-style", true, null);
265:
266:
269: public static final Attribute LIST_STYLE_IMAGE =
270: new Attribute("list-style-image", true, "none");
271:
272:
275: public static final Attribute LIST_STYLE_POSITION =
276: new Attribute("list-style-position", true, "outside");
277:
278:
281: public static final Attribute LIST_STYLE_TYPE =
282: new Attribute("list-style-type", true, "disc");
283:
284:
287: public static final Attribute MARGIN = new Attribute("margin", false, null);
288:
289:
292: public static final Attribute MARGIN_BOTTOM =
293: new Attribute("margin-bottom", false, "0");
294:
295:
298: public static final Attribute MARGIN_LEFT =
299: new Attribute("margin-left", false, "0");
300:
301:
304: public static final Attribute MARGIN_RIGHT =
305: new Attribute("margin-right", false, "0");
306:
307:
310: public static final Attribute MARGIN_TOP =
311: new Attribute("margin-top", false, "0");
312:
313:
316: public static final Attribute PADDING =
317: new Attribute("padding", false, null);
318:
319:
322: public static final Attribute PADDING_BOTTOM =
323: new Attribute("padding-bottom", false, "0");
324:
325:
328: public static final Attribute PADDING_LEFT =
329: new Attribute("padding-left", false, "0");
330:
331:
334: public static final Attribute PADDING_RIGHT =
335: new Attribute("padding-right", false, "0");
336:
337:
340: public static final Attribute PADDING_TOP =
341: new Attribute("padding-top", false, "0");
342:
343:
346: public static final Attribute TEXT_ALIGN =
347: new Attribute("text-align", true, null);
348:
349:
352: public static final Attribute TEXT_DECORATION =
353: new Attribute("text-decoration", true, "none");
354:
355:
358: public static final Attribute TEXT_INDENT =
359: new Attribute("text-indent", true, "0");
360:
361:
364: public static final Attribute TEXT_TRANSFORM =
365: new Attribute("text-transform", true, "none");
366:
367:
370: public static final Attribute VERTICAL_ALIGN =
371: new Attribute("vertical-align", false, "baseline");
372:
373:
376: public static final Attribute WHITE_SPACE =
377: new Attribute("white-space", true, "normal");
378:
379:
382: public static final Attribute WIDTH =
383: new Attribute("width", false, "auto");
384:
385:
388: public static final Attribute WORD_SPACING =
389: new Attribute("word-spacing", true, "normal");
390:
391:
394: String attStr;
395:
396:
400: boolean isInherited;
401:
402:
405: String defaultValue;
406:
407:
410: static HashMap attributeMap;
411:
412:
419: Attribute(String attr, boolean inherited, String def)
420: {
421: attStr = attr;
422: isInherited = inherited;
423: defaultValue = def;
424: if( attributeMap == null)
425: attributeMap = new HashMap();
426: attributeMap.put( attr, this );
427: }
428:
429:
433: public String toString()
434: {
435: return attStr;
436: }
437:
438:
445: public boolean isInherited()
446: {
447: return isInherited;
448: }
449:
450:
457: public String getDefaultValue()
458: {
459: return defaultValue;
460: }
461: }
462: }