1:
37:
38: package ;
39:
40: import ;
41:
42:
49: public class CSS
50: {
51:
56: public static CSS.Attribute[] getAllAttributeKeys()
57: {
58: Object[] src = Attribute.attributeMap.values().toArray();
59: CSS.Attribute[] dst = new CSS.Attribute[ src.length ];
60: System.arraycopy(src, 0, dst, 0, src.length);
61: return dst;
62: }
63:
64:
71: public static CSS.Attribute getAttribute(String name)
72: {
73: return (CSS.Attribute)Attribute.attributeMap.get( name );
74: }
75:
76: public static final class Attribute
77: {
78:
81: public static final Attribute BACKGROUND =
82: new Attribute("background", false, null);
83:
84:
87: public static final Attribute BACKGROUND_ATTACHMENT =
88: new Attribute("background-attachment", false, "scroll");
89:
90:
93: public static final Attribute BACKGROUND_COLOR =
94: new Attribute("background-color", false, "transparent");
95:
96:
99: public static final Attribute BACKGROUND_IMAGE =
100: new Attribute("background-image", false, "none");
101:
102:
105: public static final Attribute BACKGROUND_POSITION =
106: new Attribute("background-position", false, null);
107:
108:
111: public static final Attribute BACKGROUND_REPEAT =
112: new Attribute("background-repeat", false, "repeat");
113:
114:
117: public static final Attribute BORDER = new Attribute("border", false, null);
118:
119:
122: public static final Attribute BORDER_BOTTOM =
123: new Attribute("border-bottom", false, null);
124:
125:
128: public static final Attribute BORDER_BOTTOM_WIDTH =
129: new Attribute("border-bottom-width", false, "medium");
130:
131:
134: public static final Attribute BORDER_COLOR =
135: new Attribute("border-color", false, "black");
136:
137:
140: public static final Attribute BORDER_LEFT =
141: new Attribute("border-left", false, null);
142:
143:
146: public static final Attribute BORDER_LEFT_WIDTH =
147: new Attribute("border-left-width", false, "medium");
148:
149:
152: public static final Attribute BORDER_RIGHT =
153: new Attribute("border-right", false, null);
154:
155:
158: public static final Attribute BORDER_RIGHT_WIDTH =
159: new Attribute("border-right-width", false, "medium");
160:
161:
164: public static final Attribute BORDER_STYLE =
165: new Attribute("border-style", false, "none");
166:
167:
170: public static final Attribute BORDER_TOP =
171: new Attribute("border-top", false, null);
172:
173:
176: public static final Attribute BORDER_TOP_WIDTH =
177: new Attribute("border-top-width", false, "medium");
178:
179:
182: public static final Attribute BORDER_WIDTH =
183: new Attribute("border-width", false, "medium");
184:
185:
188: public static final Attribute CLEAR = new Attribute("clear", false, "none");
189:
190:
193: public static final Attribute COLOR = new Attribute("color", true, "black");
194:
195:
198: public static final Attribute DISPLAY =
199: new Attribute("display", false, "block");
200:
201:
204: public static final Attribute FLOAT = new Attribute("float", false, "none");
205:
206:
209: public static final Attribute FONT = new Attribute("font", true, null);
210:
211:
214: public static final Attribute FONT_FAMILY =
215: new Attribute("font-family", true, null);
216:
217:
220: public static final Attribute FONT_SIZE =
221: new Attribute("font-size", true, "medium");
222:
223:
226: public static final Attribute FONT_STYLE =
227: new Attribute("font-style", true, "normal");
228:
229:
232: public static final Attribute FONT_VARIANT =
233: new Attribute("font-variant", true, "normal");
234:
235:
238: public static final Attribute FONT_WEIGHT =
239: new Attribute("font-weight", true, "normal");
240:
241:
244: public static final Attribute HEIGHT =
245: new Attribute("height", false, "auto");
246:
247:
250: public static final Attribute LETTER_SPACING =
251: new Attribute("letter-spacing", true, "normal");
252:
253:
256: public static final Attribute LINE_HEIGHT =
257: new Attribute("line-height", true, "normal");
258:
259:
262: public static final Attribute LIST_STYLE =
263: new Attribute("list-style", true, null);
264:
265:
268: public static final Attribute LIST_STYLE_IMAGE =
269: new Attribute("list-style-image", true, "none");
270:
271:
274: public static final Attribute LIST_STYLE_POSITION =
275: new Attribute("list-style-position", true, "outside");
276:
277:
280: public static final Attribute LIST_STYLE_TYPE =
281: new Attribute("list-style-type", true, "disc");
282:
283:
286: public static final Attribute MARGIN = new Attribute("margin", false, null);
287:
288:
291: public static final Attribute MARGIN_BOTTOM =
292: new Attribute("margin-bottom", false, "0");
293:
294:
297: public static final Attribute MARGIN_LEFT =
298: new Attribute("margin-left", false, "0");
299:
300:
303: public static final Attribute MARGIN_RIGHT =
304: new Attribute("margin-right", false, "0");
305:
306:
309: public static final Attribute MARGIN_TOP =
310: new Attribute("margin-top", false, "0");
311:
312:
315: public static final Attribute PADDING =
316: new Attribute("padding", false, null);
317:
318:
321: public static final Attribute PADDING_BOTTOM =
322: new Attribute("padding-bottom", false, "0");
323:
324:
327: public static final Attribute PADDING_LEFT =
328: new Attribute("padding-left", false, "0");
329:
330:
333: public static final Attribute PADDING_RIGHT =
334: new Attribute("padding-right", false, "0");
335:
336:
339: public static final Attribute PADDING_TOP =
340: new Attribute("padding-top", false, "0");
341:
342:
345: public static final Attribute TEXT_ALIGN =
346: new Attribute("text-align", true, null);
347:
348:
351: public static final Attribute TEXT_DECORATION =
352: new Attribute("text-decoration", true, "none");
353:
354:
357: public static final Attribute TEXT_INDENT =
358: new Attribute("text-indent", true, "0");
359:
360:
363: public static final Attribute TEXT_TRANSFORM =
364: new Attribute("text-transform", true, "none");
365:
366:
369: public static final Attribute VERTICAL_ALIGN =
370: new Attribute("vertical-align", false, "baseline");
371:
372:
375: public static final Attribute WHITE_SPACE =
376: new Attribute("white-space", true, "normal");
377:
378:
381: public static final Attribute WIDTH =
382: new Attribute("width", false, "auto");
383:
384:
387: public static final Attribute WORD_SPACING =
388: new Attribute("word-spacing", true, "normal");
389:
390:
393: String attStr;
394:
395:
399: boolean isInherited;
400:
401:
404: String defaultValue;
405:
406:
409: static HashMap attributeMap;
410:
411:
418: Attribute(String attr, boolean inherited, String def)
419: {
420: attStr = attr;
421: isInherited = inherited;
422: defaultValue = def;
423: if( attributeMap == null)
424: attributeMap = new HashMap();
425: attributeMap.put( attr, this );
426: }
427:
428:
432: public String toString()
433: {
434: return attStr;
435: }
436:
437:
444: public boolean isInherited()
445: {
446: return isInherited;
447: }
448:
449:
456: public String getDefaultValue()
457: {
458: return defaultValue;
459: }
460: }
461: }