Example #1
0
 /**
  * Adds an <CODE>Object</CODE> to the <CODE>List</CODE>.
  *
  * @param o the object to add.
  * @return true if adding the object succeeded
  */
 public boolean add(Object o) {
   if (o instanceof ListItem) {
     ListItem item = (ListItem) o;
     if (numbered || lettered) {
       Chunk chunk;
       if (lettered) chunk = new Chunk(nextLetter(), symbol.font());
       else chunk = new Chunk(String.valueOf(first + list.size()), symbol.font());
       chunk.append(".");
       item.setListSymbol(chunk);
     } else {
       item.setListSymbol(symbol);
     }
     item.setIndentationLeft(symbolIndent);
     item.setIndentationRight(0);
     list.add(item);
   } else if (o instanceof List) {
     List nested = (List) o;
     nested.setIndentationLeft(nested.indentationLeft() + symbolIndent);
     first--;
     return list.add(nested);
   } else if (o instanceof String) {
     return this.add(new ListItem((String) o));
   }
   return false;
 }