Example usage for com.lowagie.text ListItem setIndentationLeft

List of usage examples for com.lowagie.text ListItem setIndentationLeft

Introduction

In this page you can find the example usage for com.lowagie.text ListItem setIndentationLeft.

Prototype

public void setIndentationLeft(float indentation, boolean autoindent) 

Source Link

Document

Sets the indentation of this paragraph on the left side.

Usage

From source file:org.odftoolkit.odfdom.converter.internal.itext.stylable.StylableList.java

License:Open Source License

@SuppressWarnings("unchecked")
private void addElement(Element element, boolean addLabel) {
    if (element instanceof Paragraph) {
        Paragraph p = (Paragraph) element;
        ListItem li = new StylableListItem(p);
        if (addLabel) {
            if (numbered || lettered || romanNumbered) {
                Chunk chunk = new Chunk(preSymbol, symbol.getFont());
                int index = first + list.size();
                if (lettered) {
                    chunk.append(RomanAlphabetFactory.getString(index, lowercase));
                } else if (romanNumbered) {
                    chunk.append(RomanNumberFactory.getString(index, lowercase));
                } else {
                    chunk.append(String.valueOf(index));
                }/*from   w w w . j  a  v a 2s .co  m*/
                chunk.append(postSymbol);
                li.setListSymbol(chunk);
            } else {
                li.setListSymbol(symbol);
            }
        } else {
            li.setListSymbol(new Chunk("", symbol.getFont()));
        }
        li.setIndentationLeft(symbolIndent, autoindent);
        li.setIndentationRight(0.0f);
        list.add(li);
    } else if (element instanceof List) {
        List l = (List) element;
        // open office specifies absolute list indentation
        // but iText computes indentation relative to parent list
        // so we have to set difference
        l.setIndentationLeft(l.getIndentationLeft() - this.getIndentationLeft());
        first--;
        list.add(l);
    }
}