1 47 package com.lowagie.text; 48 49 import com.lowagie.text.factories.RomanNumberFactory; 50 51 57 58 public class RomanList extends List { 59 60 62 65 public RomanList() { 66 super(true); 67 } 68 69 74 public RomanList(int symbolIndent) { 75 super(true, symbolIndent); 76 } 77 78 83 public RomanList(boolean lowercase, int symbolIndent) { 84 super(true, symbolIndent); 85 this.lowercase = lowercase; 86 } 87 88 90 96 public boolean add(Object o) { 97 if (o instanceof ListItem) { 98 ListItem item = (ListItem) o; 99 Chunk chunk; 100 chunk = new Chunk(RomanNumberFactory.getString(first + list.size(), lowercase), symbol.getFont()); 101 chunk.append(". "); 102 item.setListSymbol(chunk); 103 item.setIndentationLeft(symbolIndent, autoindent); 104 item.setIndentationRight(0); 105 list.add(item); 106 } else if (o instanceof List) { 107 List nested = (List) o; 108 nested.setIndentationLeft(nested.getIndentationLeft() + symbolIndent); 109 first--; 110 return list.add(nested); 111 } else if (o instanceof String ) { 112 return this.add(new ListItem((String ) o)); 113 } 114 return false; 115 } 116 117 119 122 public static String toRoman(int number) { 123 return RomanNumberFactory.getString(number); 124 } 125 128 public static String toRomanLowerCase(int number) { 129 return RomanNumberFactory.getString(number, true); 130 } 131 134 public static String toRomanUpperCase(int number) { 135 return RomanNumberFactory.getString(number, false); 136 } 137 138 144 public void setRomanLower(boolean romanlower) { 145 setLowercase(romanlower); 146 } 147 148 154 public boolean isRomanLower() { 155 return isLowercase(); 156 } 157 } 158 | Popular Tags |