1 package de.java2html.options; 2 3 6 public class ConversionOptionsUtilities { 7 private ConversionOptionsUtilities() { 8 } 10 11 public static String [] getPredefinedStyleTableNames() { 12 JavaSourceStyleTable[] tables = JavaSourceStyleTable.getPredefinedTables(); 13 String [] names = new String [tables.length]; 14 for (int i = 0; i < tables.length; i++) { 15 names[i] = tables[i].getName(); 16 } 17 return names; 18 } 19 20 public static String getPredefinedStyleTableNameString() { 21 String [] names = getPredefinedStyleTableNames(); 22 return ConversionOptionsUtilities.getCommaSeparatedString(names); 23 } 24 25 public static String [] getAvailableHorizontalAlignmentNames() { 26 HorizontalAlignment[] tables = HorizontalAlignment.getAll(); 27 String [] names = new String [tables.length]; 28 for (int i = 0; i < tables.length; i++) { 29 names[i] = tables[i].getName(); 30 } 31 return names; 32 } 33 34 public static String getAvailableHorizontalAlignmentNameString() { 35 String [] names = getAvailableHorizontalAlignmentNames(); 36 return ConversionOptionsUtilities.getCommaSeparatedString(names); 37 } 38 39 private static String getCommaSeparatedString(String [] names) { 40 return getSeparatedString(names, ", "); 41 } 42 43 public static String getSeparatedString(String [] strings, String separator) { 44 StringBuffer sb = new StringBuffer (); 45 for (int i = 0; i < strings.length; i++) { 46 if (i > 0) { 47 sb.append(separator); 48 } 49 sb.append(strings[i]); 50 } 51 return sb.toString(); 52 } 53 } | Popular Tags |