1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.onemind.commons.java.html.css;
22
23 import java.util.*;
24 import org.onemind.commons.java.lang.Enum;
25 /***
26 * Contains css related method and constants
27 * @author TiongHiang Lee (thlee@onemindsoft.org)
28 * @version $Id: Css.java,v 1.3 2005/03/07 17:28:17 thlee Exp $ $Name: $
29 */
30 public class Css
31 {
32
33 /***
34 * Represent the attribute (Currently contains only visual attr)
35 * @author TiongHiang Lee (thlee@onemindsoft.org)
36 * @version $Id: Css.java,v 1.3 2005/03/07 17:28:17 thlee Exp $ $Name: $
37 */
38 public static final class Attr extends Enum
39 {
40
41 private static Map _cssAttrs = new HashMap();
42
43 public static final Attr background = new Attr("background");
44
45 public static final Attr background_attachment = new Attr("background-attachment");
46
47 public static final Attr background_color = new Attr("background-color");
48
49 public static final Attr background_image = new Attr("background-image");
50
51 public static final Attr background_position = new Attr("background-position");
52
53 public static final Attr background_repeat = new Attr("background-repeat");
54
55 public static final Attr border = new Attr("border");
56
57 public static final Attr border_bottom = new Attr("border-bottom");
58
59 public static final Attr border_bottom_color = new Attr("border-bottom-color");
60
61 public static final Attr border_bottom_style = new Attr("border-bottom-style");
62
63 public static final Attr border_bottom_width = new Attr("border-bottom-width");
64
65 public static final Attr border_collapse = new Attr("border-collapse");
66
67 public static final Attr border_color = new Attr("border-color");
68
69 public static final Attr border_left = new Attr("border-left");
70
71 public static final Attr border_left_color = new Attr("border-left-color");
72
73 public static final Attr border_left_style = new Attr("border-left-style");
74
75 public static final Attr border_left_width = new Attr("border-left-width");
76
77 public static final Attr border_right = new Attr("border-right");
78
79 public static final Attr border_right_color = new Attr("border-right-color");
80
81 public static final Attr border_right_style = new Attr("border-right-style");
82
83 public static final Attr border_right_width = new Attr("border-right-width");
84
85 public static final Attr border_spacing = new Attr("border-spacing");
86
87 public static final Attr border_style = new Attr("border-style");
88
89 public static final Attr border_top = new Attr("border-top");
90
91 public static final Attr border_top_color = new Attr("border-top-color");
92
93 public static final Attr border_top_style = new Attr("border-top-style");
94
95 public static final Attr border_top_width = new Attr("border-top-width");
96
97 public static final Attr border_width = new Attr("border-width");
98
99 public static final Attr bottom = new Attr("bottom");
100
101 public static final Attr caption_side = new Attr("caption-side");
102
103 public static final Attr clear = new Attr("clear");
104
105 public static final Attr clip = new Attr("clip");
106
107 public static final Attr color = new Attr("color");
108
109 public static final Attr content = new Attr("content");
110
111 public static final Attr counter_increment = new Attr("counter-increment");
112
113 public static final Attr counter_reset = new Attr("counter-reset");
114
115 public static final Attr cursor = new Attr("cursor");
116
117 public static final Attr direction = new Attr("direction");
118
119 public static final Attr display = new Attr("display");
120
121 public static final Attr empty_cells = new Attr("empty-cells");
122
123 public static final Attr float_ = new Attr("float");
124
125 public static final Attr font = new Attr("font");
126
127 public static final Attr font_family = new Attr("font-family");
128
129 public static final Attr font_size = new Attr("font-size");
130
131 public static final Attr font_size_adjust = new Attr("font-size-adjust");
132
133 public static final Attr font_stretch = new Attr("font-stretch");
134
135 public static final Attr font_style = new Attr("font-style");
136
137 public static final Attr font_variant = new Attr("font-variant");
138
139 public static final Attr font_weight = new Attr("font-weight");
140
141 public static final Attr height = new Attr("height");
142
143 public static final Attr left = new Attr("left");
144
145 public static final Attr letter_spacing = new Attr("letter-spacing");
146
147 public static final Attr line_height = new Attr("line-height");
148
149 public static final Attr list_style = new Attr("list-style");
150
151 public static final Attr list_style_image = new Attr("list-style-image");
152
153 public static final Attr list_style_position = new Attr("list-style-position");
154
155 public static final Attr list_style_type = new Attr("list-style-type");
156
157 public static final Attr margin = new Attr("margin");
158
159 public static final Attr margin_bottom = new Attr("margin-bottom");
160
161 public static final Attr margin_left = new Attr("margin-left");
162
163 public static final Attr margin_right = new Attr("margin-right");
164
165 public static final Attr margin_top = new Attr("margin-top");
166
167 public static final Attr marker_offset = new Attr("marker-offset");
168
169 public static final Attr max_height = new Attr("max-height");
170
171 public static final Attr max_width = new Attr("max-width");
172
173 public static final Attr min_height = new Attr("min-height");
174
175 public static final Attr min_width = new Attr("min-width");
176
177 public static final Attr outline = new Attr("outline");
178
179 public static final Attr outline_color = new Attr("outline-color");
180
181 public static final Attr outline_style = new Attr("outline-style");
182
183 public static final Attr outline_width = new Attr("outline-width");
184
185 public static final Attr overflow = new Attr("overflow");
186
187 public static final Attr padding = new Attr("padding");
188
189 public static final Attr padding_bottom = new Attr("padding-bottom");
190
191 public static final Attr padding_left = new Attr("padding-left");
192
193 public static final Attr padding_right = new Attr("padding-right");
194
195 public static final Attr padding_top = new Attr("padding-top");
196
197 public static final Attr position = new Attr("position");
198
199 public static final Attr quotes = new Attr("quotes");
200
201 public static final Attr right = new Attr("right");
202
203 public static final Attr table_layout = new Attr("table-layout");
204
205 public static final Attr text_align = new Attr("text-align");
206
207 public static final Attr text_decoration = new Attr("text-decoration");
208
209 public static final Attr text_indent = new Attr("text-indent");
210
211 public static final Attr text_shadow = new Attr("text-shadow");
212
213 public static final Attr text_transform = new Attr("text-transform");
214
215 public static final Attr top = new Attr("top");
216
217 public static final Attr unicode_bidi = new Attr("unicode-bidi");
218
219 public static final Attr vertical_align = new Attr("vertical-align");
220
221 public static final Attr visibility = new Attr("visibility");
222
223 public static final Attr white_space = new Attr("white-space");
224
225 public static final Attr width = new Attr("width");
226
227 public static final Attr word_spacing = new Attr("word-spacing");
228
229 public static final Attr z_index = new Attr("z-index");
230 static
231 {
232 _cssAttrs.put(background.toString(), background);
233 _cssAttrs.put(background_attachment.toString(), background_attachment);
234 _cssAttrs.put(background_color.toString(), background_color);
235 _cssAttrs.put(background_image.toString(), background_image);
236 _cssAttrs.put(background_position.toString(), background_position);
237 _cssAttrs.put(background_repeat.toString(), background_repeat);
238 _cssAttrs.put(border.toString(), border);
239 _cssAttrs.put(border_bottom.toString(), border_bottom);
240 _cssAttrs.put(border_bottom_color.toString(), border_bottom_color);
241 _cssAttrs.put(border_bottom_style.toString(), border_bottom_style);
242 _cssAttrs.put(border_bottom_width.toString(), border_bottom_width);
243 _cssAttrs.put(border_collapse.toString(), border_collapse);
244 _cssAttrs.put(border_color.toString(), border_color);
245 _cssAttrs.put(border_left.toString(), border_left);
246 _cssAttrs.put(border_left_color.toString(), border_left_color);
247 _cssAttrs.put(border_left_style.toString(), border_left_style);
248 _cssAttrs.put(border_left_width.toString(), border_left_width);
249 _cssAttrs.put(border_right.toString(), border_right);
250 _cssAttrs.put(border_right_color.toString(), border_right_color);
251 _cssAttrs.put(border_right_style.toString(), border_right_style);
252 _cssAttrs.put(border_right_width.toString(), border_right_width);
253 _cssAttrs.put(border_spacing.toString(), border_spacing);
254 _cssAttrs.put(border_style.toString(), border_style);
255 _cssAttrs.put(border_top.toString(), border_top);
256 _cssAttrs.put(border_top_color.toString(), border_top_color);
257 _cssAttrs.put(border_top_style.toString(), border_top_style);
258 _cssAttrs.put(border_top_width.toString(), border_top_width);
259 _cssAttrs.put(border_width.toString(), border_width);
260 _cssAttrs.put(bottom.toString(), bottom);
261 _cssAttrs.put(caption_side.toString(), caption_side);
262 _cssAttrs.put(clear.toString(), clear);
263 _cssAttrs.put(clip.toString(), clip);
264 _cssAttrs.put(color.toString(), color);
265 _cssAttrs.put(content.toString(), content);
266 _cssAttrs.put(counter_increment.toString(), counter_increment);
267 _cssAttrs.put(counter_reset.toString(), counter_reset);
268 _cssAttrs.put(cursor.toString(), cursor);
269 _cssAttrs.put(direction.toString(), direction);
270 _cssAttrs.put(display.toString(), display);
271 _cssAttrs.put(empty_cells.toString(), empty_cells);
272 _cssAttrs.put(float_.toString(), float_);
273 _cssAttrs.put(font.toString(), font);
274 _cssAttrs.put(font_family.toString(), font_family);
275 _cssAttrs.put(font_size.toString(), font_size);
276 _cssAttrs.put(font_size_adjust.toString(), font_size_adjust);
277 _cssAttrs.put(font_stretch.toString(), font_stretch);
278 _cssAttrs.put(font_style.toString(), font_style);
279 _cssAttrs.put(font_variant.toString(), font_variant);
280 _cssAttrs.put(font_weight.toString(), font_weight);
281 _cssAttrs.put(height.toString(), height);
282 _cssAttrs.put(left.toString(), left);
283 _cssAttrs.put(letter_spacing.toString(), letter_spacing);
284 _cssAttrs.put(line_height.toString(), line_height);
285 _cssAttrs.put(list_style.toString(), list_style);
286 _cssAttrs.put(list_style_image.toString(), list_style_image);
287 _cssAttrs.put(list_style_position.toString(), list_style_position);
288 _cssAttrs.put(list_style_type.toString(), list_style_type);
289 _cssAttrs.put(margin.toString(), margin);
290 _cssAttrs.put(margin_bottom.toString(), margin_bottom);
291 _cssAttrs.put(margin_left.toString(), margin_left);
292 _cssAttrs.put(margin_right.toString(), margin_right);
293 _cssAttrs.put(margin_top.toString(), margin_top);
294 _cssAttrs.put(marker_offset.toString(), marker_offset);
295 _cssAttrs.put(max_height.toString(), max_height);
296 _cssAttrs.put(max_width.toString(), max_width);
297 _cssAttrs.put(min_height.toString(), min_height);
298 _cssAttrs.put(min_width.toString(), min_width);
299 _cssAttrs.put(outline.toString(), outline);
300 _cssAttrs.put(outline_color.toString(), outline_color);
301 _cssAttrs.put(outline_style.toString(), outline_style);
302 _cssAttrs.put(outline_width.toString(), outline_width);
303 _cssAttrs.put(overflow.toString(), overflow);
304 _cssAttrs.put(padding.toString(), padding);
305 _cssAttrs.put(padding_bottom.toString(), padding_bottom);
306 _cssAttrs.put(padding_left.toString(), padding_left);
307 _cssAttrs.put(padding_right.toString(), padding_right);
308 _cssAttrs.put(padding_top.toString(), padding_top);
309 _cssAttrs.put(position.toString(), position);
310 _cssAttrs.put(quotes.toString(), quotes);
311 _cssAttrs.put(right.toString(), right);
312 _cssAttrs.put(table_layout.toString(), table_layout);
313 _cssAttrs.put(text_align.toString(), text_align);
314 _cssAttrs.put(text_decoration.toString(), text_decoration);
315 _cssAttrs.put(text_indent.toString(), text_indent);
316 _cssAttrs.put(text_shadow.toString(), text_shadow);
317 _cssAttrs.put(text_transform.toString(), text_transform);
318 _cssAttrs.put(top.toString(), top);
319 _cssAttrs.put(unicode_bidi.toString(), unicode_bidi);
320 _cssAttrs.put(vertical_align.toString(), vertical_align);
321 _cssAttrs.put(visibility.toString(), visibility);
322 _cssAttrs.put(white_space.toString(), white_space);
323 _cssAttrs.put(width.toString(), width);
324 _cssAttrs.put(word_spacing.toString(), word_spacing);
325 _cssAttrs.put(z_index.toString(), z_index);
326 }
327
328 /***
329 * Resolve the str to an attr representation
330 * @param str the str
331 * @return the Attribute
332 */
333 public static Attr resolveAttr(String str)
334 {
335 return (Attr) _cssAttrs.get(str);
336 }
337
338 /***
339 * Return all the defined css attributes
340 * @return all the defined css attribute objects
341 */
342 public static List getAllAttrs()
343 {
344 return new ArrayList(_cssAttrs.values());
345 }
346
347 /***
348 * Constructor
349 * @param name the name of the attribute
350 */
351 private Attr(String name)
352 {
353 super(name);
354 }
355 }
356
357 /***
358 * The css field definitions
359 * @author TiongHiang Lee (thlee@onemindsoft.org)
360 * @version $Id: Css.java,v 1.3 2005/03/07 17:28:17 thlee Exp $ $Name: $
361 */
362 public static final class AttrUnit extends Enum
363 {
364
365 public static final AttrUnit deg = new AttrUnit("deg");
366
367 public static final AttrUnit grad = new AttrUnit("grad");
368
369 public static final AttrUnit hz = new AttrUnit("Hz");
370
371 public static final AttrUnit khz = new AttrUnit("kHz");
372
373 public static final AttrUnit ms = new AttrUnit("ms");
374
375 public static final AttrUnit percent = new AttrUnit("%");
376
377 public static final AttrUnit point = new AttrUnit("pt");
378
379 public static final AttrUnit rad = new AttrUnit("rad");
380
381 public static final AttrUnit s = new AttrUnit("s");
382
383 /***
384 * {@inheritDoc}
385 */
386 private AttrUnit(String name)
387 {
388 super(name);
389 }
390 }
391
392 /***
393 * The offset value
394 * @author TiongHiang Lee (thlee@onemindsoft.org)
395 * @version $Id: Css.java,v 1.3 2005/03/07 17:28:17 thlee Exp $ $Name: $
396 */
397 public static class AttrValue extends Enum
398 {
399
400 public static final AttrValue absolute = new AttrValue("absolute");
401
402 public static final AttrValue armenian = new AttrValue("armenian");
403
404 public static final AttrValue auto = new AttrValue("auto");
405
406 public static final AttrValue baseline = new AttrValue("baseline");
407
408 public static final AttrValue bidi_override = new AttrValue("bidi-override");
409
410 public static final AttrValue block = new AttrValue("block");
411
412 public static final AttrValue bold = new AttrValue("bold");
413
414 public static final AttrValue bolder = new AttrValue("bolder");
415
416 public static final AttrValue both = new AttrValue("both");
417
418 public static final AttrValue bottom = new AttrValue("bottom");
419
420 public static final AttrValue capitalize = new AttrValue("capitalize");
421
422 public static final AttrValue caption = new AttrValue("caption");
423
424 public static final AttrValue center = new AttrValue("center");
425
426 public static final AttrValue circle = new AttrValue("circle");
427
428 public static final AttrValue cjk_ideographic = new AttrValue("cjk-ideographic");
429
430 public static final AttrValue close_quote = new AttrValue("close-quote");
431
432 public static final AttrValue collapse = new AttrValue("collapse");
433
434 public static final AttrValue compact = new AttrValue("compact");
435
436 public static final AttrValue condensed = new AttrValue("condensed");
437
438 public static final AttrValue crosshair = new AttrValue("crosshair");
439
440 public static final AttrValue decimal = new AttrValue("decimal");
441
442 public static final AttrValue decimal_leading_zero = new AttrValue("decimal-leading-zero");
443
444 public static final AttrValue default_ = new AttrValue("default");
445
446 public static final AttrValue disc = new AttrValue("disc");
447
448 public static final AttrValue e_resize = new AttrValue("e-resize");
449
450 public static final AttrValue embed = new AttrValue("embed");
451
452 public static final AttrValue expanded = new AttrValue("expanded");
453
454 public static final AttrValue extra_condensed = new AttrValue("extra-condensed");
455
456 public static final AttrValue extra_expanded = new AttrValue("extra-expanded");
457
458 public static final AttrValue fixed = new AttrValue("fixed");
459
460 public static final AttrValue georgian = new AttrValue("georgian");
461
462 public static final AttrValue hebrew = new AttrValue("hebrew");
463
464 public static final AttrValue help = new AttrValue("help");
465
466 public static final AttrValue hidden = new AttrValue("hidden");
467
468 public static final AttrValue hide = new AttrValue("hide");
469
470 public static final AttrValue hiragana = new AttrValue("hiragana");
471
472 public static final AttrValue hiragana_iroha = new AttrValue("hiragana-iroha");
473
474 public static final AttrValue icon = new AttrValue("icon");
475
476 public static final AttrValue inherit = new AttrValue("inherit");
477
478 public static final AttrValue inline = new AttrValue("inline");
479
480 public static final AttrValue inline_table = new AttrValue("inline-table");
481
482 public static final AttrValue inside = new AttrValue("inside");
483
484 public static final AttrValue invert = new AttrValue("invert");
485
486 public static final AttrValue italic = new AttrValue("italic");
487
488 public static final AttrValue justify = new AttrValue("justify");
489
490 public static final AttrValue katakana = new AttrValue("katakana");
491
492 public static final AttrValue katakana_iroha = new AttrValue("katakana-iroha");
493
494 public static final AttrValue left = new AttrValue("left");
495
496 public static final AttrValue lighter = new AttrValue("lighter");
497
498 public static final AttrValue list_item = new AttrValue("list-item");
499
500 public static final AttrValue lower_alpha = new AttrValue("lower-alpha");
501
502 public static final AttrValue lower_greek = new AttrValue("lower-greek");
503
504 public static final AttrValue lower_latin = new AttrValue("lower-latin");
505
506 public static final AttrValue lower_roman = new AttrValue("lower-roman");
507
508 public static final AttrValue lowercase = new AttrValue("lowercase");
509
510 public static final AttrValue ltr = new AttrValue("ltr");
511
512 public static final AttrValue marker = new AttrValue("marker");
513
514 public static final AttrValue menu = new AttrValue("menu");
515
516 public static final AttrValue message_box = new AttrValue("message-box");
517
518 public static final AttrValue middle = new AttrValue("middle");
519
520 public static final AttrValue move = new AttrValue("move");
521
522 public static final AttrValue n_resize = new AttrValue("n-resize");
523
524 public static final AttrValue narrower = new AttrValue("narrower");
525
526 public static final AttrValue ne_resize = new AttrValue("ne-resize");
527
528 public static final AttrValue no_open_quote = new AttrValue("no-open-quote");
529
530 public static final AttrValue no_repeat = new AttrValue("no-repeat");
531
532 public static final AttrValue none = new AttrValue("none");
533
534 public static final AttrValue normal = new AttrValue("normal");
535
536 public static final AttrValue nowrap = new AttrValue("nowrap");
537
538 public static final AttrValue nw_resize = new AttrValue("nw-resize");
539
540 public static final AttrValue oblique = new AttrValue("oblique");
541
542 public static final AttrValue open_quote = new AttrValue("open-quote");
543
544 public static final AttrValue outside = new AttrValue("outside");
545
546 public static final AttrValue pointer = new AttrValue("pointer");
547
548 public static final AttrValue pre = new AttrValue("pre");
549
550 public static final AttrValue relative = new AttrValue("relative");
551
552 public static final AttrValue repeat = new AttrValue("repeat");
553
554 public static final AttrValue repeat_x = new AttrValue("repeat-x");
555
556 public static final AttrValue repeat_y = new AttrValue("repeat-y");
557
558 public static final AttrValue right = new AttrValue("right");
559
560 public static final AttrValue rtl = new AttrValue("rtl");
561
562 public static final AttrValue run_in = new AttrValue("rul-in");
563
564 public static final AttrValue s_resize = new AttrValue("s-resize");
565
566 public static final AttrValue scroll = new AttrValue("scroll");
567
568 public static final AttrValue se_resize = new AttrValue("se-resize");
569
570 public static final AttrValue semi_condensed = new AttrValue("semi-condensed");
571
572 public static final AttrValue semi_expanded = new AttrValue("semi-expanded");
573
574 public static final AttrValue separate = new AttrValue("separate");
575
576 public static final AttrValue show = new AttrValue("show");
577
578 public static final AttrValue small_caps = new AttrValue("small-caps");
579
580 public static final AttrValue small_caption = new AttrValue("small-caption");
581
582 public static final AttrValue square = new AttrValue("square");
583
584 public static final AttrValue static_ = new AttrValue("static");
585
586 public static final AttrValue status_bar = new AttrValue("status-bar");
587
588 public static final AttrValue sub = new AttrValue("sub");
589
590 public static final AttrValue super_ = new AttrValue("super");
591
592 public static final AttrValue sw_resize = new AttrValue("sw-resize");
593
594 public static final AttrValue table = new AttrValue("table");
595
596 public static final AttrValue table_caption = new AttrValue("table-caption");
597
598 public static final AttrValue table_cell = new AttrValue("table-cell");
599
600 public static final AttrValue table_column = new AttrValue("table-column");
601
602 public static final AttrValue table_column_group = new AttrValue("table-column-group");
603
604 public static final AttrValue table_footer_group = new AttrValue("table-footer-group");
605
606 public static final AttrValue table_header_group = new AttrValue("table-header-group");
607
608 public static final AttrValue table_row = new AttrValue("table-row");
609
610 public static final AttrValue table_row_group = new AttrValue("table-row-group");
611
612 public static final AttrValue text = new AttrValue("text");
613
614 public static final AttrValue text_bottom = new AttrValue("text-bottom");
615
616 public static final AttrValue text_top = new AttrValue("text-top");
617
618 public static final AttrValue top = new AttrValue("top");
619
620 public static final AttrValue transparent = new AttrValue("transparent");
621
622 public static final AttrValue ultra_condensed = new AttrValue("ultra-condensed");
623
624 public static final AttrValue ultra_expanded = new AttrValue("ultra-expanded");
625
626 public static final AttrValue upper_alpha = new AttrValue("upper-alpha");
627
628 public static final AttrValue upper_latin = new AttrValue("upper-latin");
629
630 public static final AttrValue upper_roman = new AttrValue("upper-roman");
631
632 public static final AttrValue uppercase = new AttrValue("uppercase");
633
634 public static final AttrValue visible = new AttrValue("visible");
635
636 public static final AttrValue w_resize = new AttrValue("w-resize");
637
638 public static final AttrValue wait = new AttrValue("wait");
639
640 public static final AttrValue wider = new AttrValue("wider");
641
642 /***
643 * {@inheritDoc}
644 */
645 private AttrValue(String name)
646 {
647 super(name);
648 }
649 }
650 }