Example usage for com.lowagie.text Cell Cell

List of usage examples for com.lowagie.text Cell Cell

Introduction

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

Prototype

public Cell() 

Source Link

Document

Constructs an empty Cell.

Usage

From source file:org.activityinfo.server.report.renderer.itext.ThemeHelper.java

License:Open Source License

/**
 * Renders a Cell for/*from   ww  w  .ja  v  a 2  s.  com*/
 *
 * @param label
 * @param header
 * @param depth
 * @param leaf
 * @param horizantalAlignment
 * @return
 * @throws BadElementException
 */
public static Cell bodyCell(String label, boolean header, int depth, boolean leaf, int horizantalAlignment)
        throws BadElementException {

    Cell cell = new Cell();
    cell.setHorizontalAlignment(horizantalAlignment);

    if (label != null) {
        Paragraph para = new Paragraph(label);
        Font font = bodyFont();
        if (depth == 0 && !leaf) {
            font.setColor(Color.WHITE);
        }
        para.setFont(font);
        para.setIndentationLeft(LEFT_INDENT + (header ? HEADER3_FONT_SIZE * depth : 0));
        cell.addElement(para);
    }

    cell.setBorderWidthLeft(0f);
    cell.setBorderWidthRight(0);
    cell.setBorderWidthTop(0);

    if (!leaf && depth == 0) {
        cell.setBackgroundColor(BLUE4); // #95B3D7
        cell.setBorderWidthBottom(THIN_BORDER_WIDTH);
        cell.setBorderColorBottom(BLUE5); // #DBE5F1
    } else if (!leaf && depth == 1) {
        cell.setBackgroundColor(BLUE5);
        cell.setBorderWidthBottom(THIN_BORDER_WIDTH);
        cell.setBorderColorBottom(BLUE2);
    } else {
        cell.setBorderWidthBottom(THIN_BORDER_WIDTH);
        cell.setBorderColorBottom(BLUE5);
        cell.setBorderWidthTop(THIN_BORDER_WIDTH);
        cell.setBorderColorTop(BLUE5);
    }

    return cell;
}

From source file:org.eclipse.osee.framework.ui.skynet.util.TableWriterAdaptor.java

License:Open Source License

public void writeHeader(Table table, String[] headers) throws Exception {
    for (String header : headers) {
        Cell cell = new Cell();
        cell.setHeader(true);/*from www  .  j  a va2s  . c o  m*/
        cell.setColspan(1);
        cell.setBackgroundColor(WebColors.getRGBColor("#d9d9d9"));
        cell.setHorizontalAlignment(ElementTags.ALIGN_CENTER);

        Font font = FontFactory.getFont("Times New Roman", BaseFont.CP1252, BaseFont.EMBEDDED, 9, Font.BOLD,
                WebColors.getRGBColor("#000000"));
        Paragraph paragraph = new Paragraph(header, font);
        paragraph.setAlignment(ElementTags.ALIGN_CENTER);
        cell.add(paragraph);
        table.addCell(cell);
    }
}

From source file:org.eclipse.osee.framework.ui.skynet.util.TableWriterAdaptor.java

License:Open Source License

public void writeRow(Table table, String... cellData) {
    for (String cellText : cellData) {
        Cell cell = new Cell();
        cell.setHeader(false);/*from   w w  w .  j  a  v a 2  s  .  c  o  m*/
        cell.setColspan(1);
        Font font = FontFactory.getFont("Times New Roman", BaseFont.CP1252, BaseFont.EMBEDDED, 9, Font.NORMAL,
                WebColors.getRGBColor("#000000"));
        Paragraph paragraph = new Paragraph(cellText, font);
        cell.add(paragraph);
        table.addCell(cell);
    }
}

From source file:org.sigmah.server.report.renderer.itext.ThemeHelper.java

License:Open Source License

public static Cell columnHeaderCell(String label, boolean leaf, int hAlign) throws BadElementException {
    Paragraph para = new Paragraph(label);
    para.setFont(new Font(Font.HELVETICA, 10, Font.NORMAL, Color.WHITE));

    Cell cell = new Cell();
    cell.addElement(para);/*from  ww w  . ja  v  a  2 s.c om*/
    cell.setHorizontalAlignment(hAlign);
    cell.setHeader(true);
    cell.setVerticalAlignment(Cell.ALIGN_BOTTOM);
    cell.setBackgroundColor(new Color(55, 96, 145));

    cell.setBorderWidth(0);

    return cell;
}

From source file:org.sigmah.server.report.renderer.itext.ThemeHelper.java

License:Open Source License

public static Cell cornerCell() {
    Cell cell = new Cell();
    cell.setHeader(true);//from  ww  w .j  av  a2  s.co m
    cell.setBorderWidth(0);
    cell.setBackgroundColor(new Color(55, 96, 145));
    return cell;
}

From source file:org.sigmah.server.report.renderer.itext.ThemeHelper.java

License:Open Source License

/**
 * Renders a Cell for// w w  w  . j a  v  a  2  s. com
 *
 * @param label
 * @param header
 * @param depth
 * @param leaf
 * @param horizantalAlignment
 * @return
 * @throws BadElementException
 */
public static Cell bodyCell(String label, boolean header, int depth, boolean leaf, int horizantalAlignment)
        throws BadElementException {

    Cell cell = new Cell();
    cell.setHorizontalAlignment(horizantalAlignment);

    if (label != null) {
        Paragraph para = new Paragraph(label);
        Font font = new Font(Font.HELVETICA, 10, Font.NORMAL, Color.BLACK);
        if (depth == 0 && !leaf) {
            font.setColor(Color.WHITE);
        }
        para.setFont(font);
        para.setIndentationLeft(5.4f + (header ? 12 * depth : 0));
        cell.addElement(para);
    }

    cell.setBorderWidthLeft(0f);
    cell.setBorderWidthRight(0);
    cell.setBorderWidthTop(0);

    if (!leaf && depth == 0) {
        cell.setBackgroundColor(new Color(149, 179, 215)); // #95B3D7
        cell.setBorderWidthBottom(0.5f);
        cell.setBorderColorBottom(new Color(219, 229, 241)); // #DBE5F1
    } else if (!leaf && depth == 1) {
        cell.setBackgroundColor(new Color(219, 229, 241));
        cell.setBorderWidthBottom(0.5f);
        cell.setBorderColorBottom(new Color(79, 129, 189));
    } else {
        cell.setBorderWidthBottom(0.5f);
        cell.setBorderColorBottom(new Color(219, 229, 241));
        cell.setBorderWidthTop(0.5f);
        cell.setBorderColorTop(new Color(219, 229, 241));
    }

    return cell;
}

From source file:s2s.luna.reports.Report_DOC_VAL_RSO.java

License:GNU General Public License

public void writePair(CenterMiddleTable tbl, Pair pair, int iLevel) throws Exception {
    if (iLevel != 0) {
        if (iLevel > 1) {
            Cell cell = new Cell();
            cell.setColspan(iLevel - 1);
            cell.setBorder(0);//w ww  . j ava2 s. c o  m
            tbl.addCell(cell);
        }

        tbl.toLeft();
        tbl.addCell(pair.strName, 14 - ((iLevel - 1) * 2), 4 - iLevel);

        tbl.toRight();
        tbl.addCell((pair.iPage + iIndexPageCount) + "", 14 - ((iLevel - 1) * 2));
    }

    Iterator it = pair.Children.iterator();
    while (it.hasNext()) {
        Pair pp = (Pair) it.next();
        writePair(tbl, pp, iLevel + 1);
    }
}