1 47 package com.lowagie.text; 48 49 56 57 public class ZapfDingbatsNumberList extends List { 58 59 62 protected int type; 63 64 68 public ZapfDingbatsNumberList(int type) { 69 super(true); 70 this.type = type; 71 float fontsize = symbol.getFont().getSize(); 72 symbol.setFont(FontFactory.getFont(FontFactory.ZAPFDINGBATS, fontsize, Font.NORMAL)); 73 } 74 75 80 public ZapfDingbatsNumberList(int type, int symbolIndent) { 81 super(true, symbolIndent); 82 this.type = type; 83 float fontsize = symbol.getFont().getSize(); 84 symbol.setFont(FontFactory.getFont(FontFactory.ZAPFDINGBATS, fontsize, Font.NORMAL)); 85 } 86 87 92 public void setType(int type) { 93 this.type = type; 94 } 95 96 101 public int getType() { 102 return type; 103 } 104 105 111 public boolean add(Object o) { 112 if (o instanceof ListItem) { 113 ListItem item = (ListItem) o; 114 Chunk chunk; 115 switch (type ) { 116 case 0: 117 chunk = new Chunk((char)(first + list.size() + 171), symbol.getFont()); 118 break; 119 case 1: 120 chunk = new Chunk((char)(first + list.size() + 181), symbol.getFont()); 121 break; 122 case 2: 123 chunk = new Chunk((char)(first + list.size() + 191), symbol.getFont()); 124 break; 125 default: 126 chunk = new Chunk((char)(first + list.size() + 201), symbol.getFont()); 127 } 128 chunk.append(" "); 129 item.setListSymbol(chunk); 130 item.setIndentationLeft(symbolIndent, autoindent); 131 item.setIndentationRight(0); 132 list.add(item); 133 } else if (o instanceof List) { 134 List nested = (List) o; 135 nested.setIndentationLeft(nested.getIndentationLeft() + symbolIndent); 136 first--; 137 return list.add(nested); 138 } else if (o instanceof String ) { 139 return this.add(new ListItem((String ) o)); 140 } 141 return false; 142 } 143 } 144 | Popular Tags |