|
1 | 1 | package com.itextpdf.layout.element;
|
2 | 2 |
|
3 | 3 | import com.itextpdf.kernel.pdf.PdfName;
|
| 4 | +import com.itextpdf.layout.Property; |
4 | 5 | import com.itextpdf.layout.renderer.ListItemRenderer;
|
5 | 6 |
|
6 | 7 | /**
|
@@ -37,6 +38,46 @@ public ListItem(Image image) {
|
37 | 38 | add(image);
|
38 | 39 | }
|
39 | 40 |
|
| 41 | + /** |
| 42 | + * Sets the list item symbol to be used. |
| 43 | + * @param symbol the textual symbol to be used for the item. |
| 44 | + * @return this list item. |
| 45 | + */ |
| 46 | + public ListItem setListSymbol(String symbol) { |
| 47 | + return setListSymbol(new Text(symbol)); |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * Sets the list item symbol to be used. |
| 52 | + * @param text the {@link Text} object to be used for the item. |
| 53 | + * @return this list item. |
| 54 | + */ |
| 55 | + public ListItem setListSymbol(Text text) { |
| 56 | + return setProperty(Property.LIST_SYMBOL, text); |
| 57 | + } |
| 58 | + |
| 59 | + /** |
| 60 | + * Sets the list item symbol to be used. |
| 61 | + * @param image the {@link Image} object to be used for the item. |
| 62 | + * @return this list. |
| 63 | + */ |
| 64 | + public ListItem setListSymbol(Image image) { |
| 65 | + return setProperty(Property.LIST_SYMBOL, image); |
| 66 | + } |
| 67 | + |
| 68 | + /** |
| 69 | + * Sets the list item numbering type to be used. |
| 70 | + * @param listNumberingType the {@link Property#ListNumberingType} that will generate appropriate prefixes for the {@link ListItem}. |
| 71 | + * @return this list item. |
| 72 | + */ |
| 73 | + public ListItem setListSymbol(Property.ListNumberingType listNumberingType) { |
| 74 | + // Do not draw any points after ZapfDingbats special number symbol |
| 75 | + if (listNumberingType == Property.ListNumberingType.ZAPF_DINGBATS_1 || listNumberingType == Property.ListNumberingType.ZAPF_DINGBATS_2 || |
| 76 | + listNumberingType == Property.ListNumberingType.ZAPF_DINGBATS_3 || listNumberingType == Property.ListNumberingType.ZAPF_DINGBATS_4) { |
| 77 | + } |
| 78 | + return setProperty(Property.LIST_SYMBOL, listNumberingType); |
| 79 | + } |
| 80 | + |
40 | 81 | @Override
|
41 | 82 | protected ListItemRenderer makeNewRenderer() {
|
42 | 83 | return new ListItemRenderer(this);
|
|
0 commit comments