01: package de.java2html.options;
02:
03: /**
04: * @author Markus Gebhard
05: */
06: public class ConversionOptionsUtilities {
07: private ConversionOptionsUtilities() {
08: //nothing to do
09: }
10:
11: public static String[] getPredefinedStyleTableNames() {
12: JavaSourceStyleTable[] tables = JavaSourceStyleTable
13: .getPredefinedTables();
14: String[] names = new String[tables.length];
15: for (int i = 0; i < tables.length; i++) {
16: names[i] = tables[i].getName();
17: }
18: return names;
19: }
20:
21: public static String getPredefinedStyleTableNameString() {
22: String[] names = getPredefinedStyleTableNames();
23: return ConversionOptionsUtilities
24: .getCommaSeparatedString(names);
25: }
26:
27: public static String[] getAvailableHorizontalAlignmentNames() {
28: HorizontalAlignment[] tables = HorizontalAlignment.getAll();
29: String[] names = new String[tables.length];
30: for (int i = 0; i < tables.length; i++) {
31: names[i] = tables[i].getName();
32: }
33: return names;
34: }
35:
36: public static String getAvailableHorizontalAlignmentNameString() {
37: String[] names = getAvailableHorizontalAlignmentNames();
38: return ConversionOptionsUtilities
39: .getCommaSeparatedString(names);
40: }
41:
42: private static String getCommaSeparatedString(String[] names) {
43: return getSeparatedString(names, ", ");
44: }
45:
46: public static String getSeparatedString(String[] strings,
47: String separator) {
48: StringBuffer sb = new StringBuffer();
49: for (int i = 0; i < strings.length; i++) {
50: if (i > 0) {
51: sb.append(separator);
52: }
53: sb.append(strings[i]);
54: }
55: return sb.toString();
56: }
57: }
|