01: package de.java2html.options;
02:
03: import java.util.ArrayList;
04: import java.util.HashMap;
05: import java.util.List;
06: import java.util.Map;
07:
08: /**
09: * @author Markus Gebhard
10: */
11: public abstract class HorizontalAlignment {
12: private final static Map byName = new HashMap();
13: private final static List all = new ArrayList();
14:
15: public final static HorizontalAlignment LEFT = new HorizontalAlignment(
16: "left") {
17: public void accept(IHorizontalAlignmentVisitor visitor) {
18: visitor.visitLeftAlignment(this );
19: }
20: };
21: public final static HorizontalAlignment CENTER = new HorizontalAlignment(
22: "center") {
23: public void accept(IHorizontalAlignmentVisitor visitor) {
24: visitor.visitCenterAlignment(this );
25: }
26: };
27: public final static HorizontalAlignment RIGHT = new HorizontalAlignment(
28: "right") {
29: public void accept(IHorizontalAlignmentVisitor visitor) {
30: visitor.visitRightAlignment(this );
31: }
32: };
33:
34: public static HorizontalAlignment getByName(String name) {
35: return (HorizontalAlignment) byName.get(name);
36: }
37:
38: public static HorizontalAlignment[] getAll() {
39: return (HorizontalAlignment[]) all
40: .toArray(new HorizontalAlignment[all.size()]);
41: }
42:
43: private String name;
44:
45: public HorizontalAlignment(String name) {
46: this .name = name;
47: byName.put(name, this );
48: all.add(this );
49: }
50:
51: public String getName() {
52: return name;
53: }
54:
55: public String toString() {
56: return "HorizontalAlignment{" + getName() + "}";
57: }
58:
59: public abstract void accept(IHorizontalAlignmentVisitor visitor);
60:
61: }
|