1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sourceforge.jeuclid.context;
20
21 import net.sourceforge.jeuclid.context.typewrapper.BooleanTypeWrapper;
22 import net.sourceforge.jeuclid.context.typewrapper.ColorTypeWrapper;
23 import net.sourceforge.jeuclid.context.typewrapper.EnumTypeWrapper;
24 import net.sourceforge.jeuclid.context.typewrapper.NumberTypeWrapper;
25 import net.sourceforge.jeuclid.context.typewrapper.TLIListTypeWrapper;
26 import net.sourceforge.jeuclid.context.typewrapper.TypeWrapper;
27
28
29
30
31
32
33 public enum Parameter {
34
35
36
37 DISPLAY(EnumTypeWrapper.getInstance(Display.class), false, "display",
38 "display style"),
39
40
41
42
43
44 MATHSIZE(NumberTypeWrapper.getInstance(Float.class), false, "fontSize",
45 "font size used for the output (mathsize)"),
46
47
48
49
50 SCRIPTMINSIZE(NumberTypeWrapper.getInstance(Float.class), false,
51 "scriptMinSize", "font size to be used for smallest script"),
52
53
54 SCRIPTSIZEMULTIPLIER(NumberTypeWrapper.getInstance(Float.class), false,
55 "scriptSizeMult", "script size multiplier"),
56
57
58 SCRIPTLEVEL(NumberTypeWrapper.getInstance(Integer.class), false,
59 "scriptLevel", "script level"),
60
61
62
63
64 ANTIALIAS_MINSIZE(NumberTypeWrapper.getInstance(Float.class), false,
65 "antiAliasMinSize",
66 "minimum font size for which anti-alias is turned on"),
67
68
69
70
71
72 DEBUG(BooleanTypeWrapper.getInstance(), false, "debug",
73 "debug mode - if on, elements will have borders drawn around them"),
74
75
76
77
78 ANTIALIAS(BooleanTypeWrapper.getInstance(), false, "antiAlias",
79 "anti-alias mode"),
80
81
82
83
84 MATHCOLOR(ColorTypeWrapper.getInstance(), false, "foregroundColor",
85 "default foreground color (mathcolor)"),
86
87
88
89
90 MATHBACKGROUND(ColorTypeWrapper.getInstance(), true, "backgroundColor",
91 "default background color (mathbackground)"),
92
93
94
95
96
97
98 FONTS_SANSSERIF(TLIListTypeWrapper.getInstance(), false,
99 "fontsSansSerif", "list of font families for Sans-Serif"),
100
101
102
103
104
105
106 FONTS_SERIF(TLIListTypeWrapper.getInstance(), false, "fontsSerif",
107 "list of font families for Serif"),
108
109
110
111
112
113
114 FONTS_MONOSPACED(TLIListTypeWrapper.getInstance(), false,
115 "fontsMonospaced", "list of font families for Monospaced"),
116
117
118
119
120
121
122 FONTS_SCRIPT(TLIListTypeWrapper.getInstance(), false, "fontsScript",
123
124 "list of font families for Script"),
125
126
127
128
129
130 FONTS_FRAKTUR(TLIListTypeWrapper.getInstance(), false, "fontsFraktur",
131 "list of font families for Fraktur"),
132
133
134
135
136
137
138 FONTS_DOUBLESTRUCK(TLIListTypeWrapper.getInstance(), false,
139 "fontsDoublestruck", "list of font families for Double-Struck"),
140
141
142
143
144
145
146 MFRAC_KEEP_SCRIPTLEVEL(
147 BooleanTypeWrapper.getInstance(),
148 false,
149 "mfracKeepScriptLevel",
150 "if true, <mfrac> element will NEVER increase children's scriptlevel (in violation of the spec)");
151
152 private final TypeWrapper typeWrapper;
153
154 private final boolean nullAllowed;
155
156 private final String optionName;
157
158 private final String optionDesc;
159
160 private Parameter(final TypeWrapper aTypeWrapper,
161 final boolean nullIsAllowed, final String oName,
162 final String oDesc) {
163 this.typeWrapper = aTypeWrapper;
164 this.nullAllowed = nullIsAllowed;
165 this.optionName = oName;
166 this.optionDesc = oDesc;
167 }
168
169
170
171
172 public TypeWrapper getTypeWrapper() {
173 return this.typeWrapper;
174 }
175
176
177
178
179 public String getOptionName() {
180 return this.optionName;
181 }
182
183
184
185
186 public String getOptionDesc() {
187 return this.optionDesc;
188 }
189
190
191
192
193
194
195
196
197 public boolean valid(final Object o) {
198 return o == null && this.nullAllowed || this.typeWrapper.valid(o);
199 }
200
201
202
203
204
205
206
207
208
209 public Object fromString(final String value) {
210 return this.typeWrapper.fromString(value);
211 }
212
213
214
215
216
217
218
219
220
221 public String toString(final Object value) {
222 return this.typeWrapper.toString(value);
223 }
224 }