示例#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;
     Chunk chunk = new Chunk(preSymbol, symbol.getFont());
     chunk.append(String.valueOf((char) zn));
     chunk.append(postSymbol);
     item.setListSymbol(chunk);
     item.setIndentationLeft(symbolIndent, autoindent);
     item.setIndentationRight(0);
     list.add(item);
   } else if (o instanceof List) {
     List nested = (List) o;
     nested.setIndentationLeft(nested.getIndentationLeft() + symbolIndent);
     first--;
     return list.add(nested);
   } else if (o instanceof String) {
     return this.add(new ListItem((String) o));
   }
   return false;
 }