List of usage examples for com.itextpdf.text List isEmpty
public boolean isEmpty()
true
if the list is empty. From source file:fenix.planner.pdf.PDFGenerator.java
License:Open Source License
private void parseAndAddFreeText(String text) throws DocumentException { List currentList = null; for (String line : text.split("\n")) { if (line.startsWith("- ")) { if (currentList == null) { currentList = new List(false, 10f); currentList.setListSymbol("\u2022"); }/*w ww . j a va 2s . co m*/ ListItem item = new ListItem(); currentList.add(item); parseAndAddBodyTextLineToParagraph(item, line.substring(2), freeTextFont); } else { if (currentList != null && !currentList.isEmpty()) { currentList.getLastItem().setSpacingAfter(5); currentList.getFirstItem().setSpacingBefore(5); document.add(currentList); currentList = null; } Paragraph p = new Paragraph(); p.setSpacingAfter(5); p.setSpacingBefore(5); parseAndAddBodyTextLineToParagraph(p, line, freeTextFont); document.add(p); } } }