Example usage for com.itextpdf.text Chunk setGenericTag

List of usage examples for com.itextpdf.text Chunk setGenericTag

Introduction

In this page you can find the example usage for com.itextpdf.text Chunk setGenericTag.

Prototype


public Chunk setGenericTag(final String text) 

Source Link

Document

Sets the generic tag Chunk.

Usage

From source file:com.vectorprint.report.itext.DefaultElementProducer.java

License:Open Source License

/**
 * Create a piece of text (part of a Phrase), style it and ad the data.
 *
 * @param data//  w w  w  .j a  v  a2s.  c om
 * @param stylers
 * @return
 * @throws VectorPrintException
 */
public Chunk createChunk(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException {
    Chunk c = styleHelper.style(new Chunk(), data, stylers);

    if (data != null) {
        c.append(formatValue(data));
    }

    if (notDelayedStyle(c, ADV + (++advancedTag), stylers) && debug) {
        c.setGenericTag(String.valueOf(++genericTag));
    }

    return c;
}

From source file:com.vectorprint.report.itext.DefaultElementProducer.java

License:Open Source License

private <P extends TextElementArray> P initTextElementArray(P text, Object data,
        Collection<? extends BaseStyler> stylers) throws VectorPrintException {
    if (data != null) {
        text.add(data instanceof Element ? (Element) data : new Chunk(formatValue(data)));
    }//from   w  ww.j a v a2s.  co m

    boolean first = true;
    for (Chunk c : (List<Chunk>) text.getChunks()) {
        styleLink(stylers, first, c, data);
        if (first) {
            first = false;
        }
        if (notDelayedStyle(c, ADV + (++advancedTag), stylers) && debug) {
            c.setGenericTag(String.valueOf(++genericTag));
        }
    }

    return text;
}

From source file:com.vectorprint.report.itext.style.StyleHelper.java

License:Open Source License

/**
 * register advanced stylers with the EventHelper to do the styling later
 *
 * @param c//from  w w  w.j av  a  2  s  .co m
 * @param tag
 * @param stylers
 * @param eventHelper
 * @param img the value of rect
 * @see EventHelper#onGenericTag(com.itextpdf.text.pdf.PdfWriter, com.itextpdf.text.Document,
 * com.itextpdf.text.Rectangle, java.lang.String)
 */
public static void delayedStyle(Chunk c, String tag, Collection<? extends Advanced> stylers,
        EventHelper eventHelper, Image img) {
    // add to pagehelper and set generic tag
    eventHelper.addDelayedStyler(tag, stylers, c, img);
    c.setGenericTag(tag);
}