Example usage for com.lowagie.text Table Table

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

Introduction

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

Prototype

public Table(Table t) 

Source Link

Document

Copy constructor (shallow copy).

Usage

From source file:org.eclipse.osee.ats.rest.internal.build.report.table.BuildTraceTable.java

License:Open Source License

public void addRpcrToTable(String rpcr, Map<ArtifactReadable, Iterable<ArtifactReadable>> requirementsToTests)
        throws OseeCoreException {
    try {//w ww . java  2 s .c  om
        Table nestedRequirementTable = new Table(2);
        //         nestedRequirementTable.setAutoFillEmptyCells(true);
        SortedSet<Pair<String, Table>> nestedRpcr = new TreeSet<Pair<String, Table>>(PairCompare);

        for (Entry<ArtifactReadable, Iterable<ArtifactReadable>> entry : requirementsToTests.entrySet()) {
            ArtifactReadable changedReq = entry.getKey();
            if (Conditions.notNull(changedReq)) {
                Table nestedTestScriptTable = new Table(1 + uriProvider.getColumnCount());
                nestedTestScriptTable.setAutoFillEmptyCells(true);
                addNewTestScriptTraceCells(nestedTestScriptTable, entry.getValue());
                // Store Requirement string and TestScriptTable for sorting
                Pair<String, Table> newPair = new Pair<String, Table>(changedReq.getName(),
                        nestedTestScriptTable);
                nestedRpcr.add(newPair);
            }
        }
        // Create sorted requirement Table
        Iterator<Pair<String, Table>> treeItr = nestedRpcr.iterator();
        while (treeItr.hasNext()) {
            Pair<String, Table> pair = treeItr.next();
            addRequirementTraceCells(nestedRequirementTable, pair.getFirst());
            nestedRequirementTable.insertTable(pair.getSecond());
        }
        // Save RPCR ID with sorted requirement string Table.
        Pair<String, Table> newPair = new Pair<String, Table>(rpcr, nestedRequirementTable);
        sortedRpcr.add(newPair);
    } catch (BadElementException ex) {
        OseeExceptions.wrapAndThrow(ex);
    }

}

From source file:org.eclipse.osee.ats.rest.internal.build.report.table.UrlListTable.java

License:Open Source License

public void initializeTable(String title, String lastRun, String... headers) throws OseeCoreException {
    document = new Document();
    lastRunDate = lastRun;//from w  w w . ja  v a2 s  .  com
    sortedList = new TreeSet<List<Anchor>>(new Comparator<List<Anchor>>() {

        @Override
        public int compare(List<Anchor> anchor1, List<Anchor> anchor2) {
            String name1 = anchor1.get(0).toString();
            String name2 = anchor2.get(0).toString();
            return name1.compareTo(name2);
        }
    });
    HtmlWriter.getInstance(document, output);
    document.addTitle(title);
    document.open();

    try {
        table = new Table(headers.length);
    } catch (BadElementException ex) {
        OseeExceptions.wrapAndThrow(ex);
    }

    for (String header : headers) {
        Cell headerCell = new Cell(header);
        headerCell.setHeader(true);
        headerCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(headerCell);
    }
    table.setWidth(10f * headers.length);
    table.setAlignment(Element.ALIGN_BOTTOM);
}

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

License:Open Source License

public void writeHeader(String[] headers) throws Exception {
    table = new Table(headers.length);
    table.setBorder(1);/*from  ww  w  .ja v a 2s  . c  o  m*/
    table.setSpacing(1);
    table.setPadding(1);
    //      this.table.setCellsFitPage(true);
    //      this.table.setTableFitsPage(true);
    table.setBorderColor(new Color(0, 0, 0));
    writeHeader(table, headers);
}

From source file:org.egov.infra.web.displaytag.export.EGovPdfView.java

License:Open Source License

/**
 * Initialize the main info holder table.
 * @throws BadElementException for errors during table initialization
 *///from w  ww.  j av a2  s  .c o m
protected void initTable() throws BadElementException {
    this.tablePDF = new Table(this.model.getNumberOfColumns());
    this.tablePDF.setCellsFitPage(true);
    this.tablePDF.setWidth(100);

    this.tablePDF.setPadding(2);
    this.tablePDF.setSpacing(0);

    this.smallFont = FontFactory.getFont(FontFactory.HELVETICA, 7, Font.NORMAL, new Color(0, 0, 0));
    /*
     * try { BaseFont btKannada = BaseFont.createFont("Tunga", "Identity-H", BaseFont.NOT_EMBEDDED); } catch (DocumentException e) {   } catch (IOException e) {   }
     */

}

From source file:org.goobi.production.flow.helper.SearchResultHelper.java

License:Open Source License

public void getResultAsRtf(List<SearchColumn> columnList, String filter, String order,
        boolean showClosedProcesses, boolean showArchivedProjects, OutputStream out) {
    Document document = new Document();

    RtfWriter2.getInstance(document, out);

    @SuppressWarnings("rawtypes")
    List list = search(columnList, filter, order, showClosedProcesses, showArchivedProjects);

    document.open();/* w  w w .j  a  va2 s  . co  m*/

    Table table = null;
    try {
        table = new Table(columnList.size());
    } catch (BadElementException e1) {
    }
    table.setBorderWidth(1);

    for (SearchColumn sc : columnList) {
        Cell cell = new Cell(Helper.getTranslation(sc.getValue()));
        cell.setHeader(true);
        table.addCell(cell);
    }
    table.endHeaders();

    for (Object obj : list) {
        Object[] objArr = (Object[]) obj;
        for (Object entry : objArr) {
            Cell cell = new Cell((String) entry);
            table.addCell(cell);
        }

    }
    try {
        document.add(table);
    } catch (DocumentException e) {
    }

    document.close();

    return;
}

From source file:org.inbio.modeling.core.manager.impl.ExportManagerImpl.java

License:Open Source License

private Table create2columnTable() throws BadElementException {
    // Print the metadata information
    Table table = new Table(2);
    table.setBorderColor(Color.GRAY);
    table.setPadding(2);/*from ww w  .ja  v  a  2s.  c  o  m*/
    table.setSpacing(2);
    table.setBorderWidth(1);
    table.setTableFitsPage(true);

    return table;
}

From source file:org.kuali.kfs.module.tem.pdf.Coversheet.java

License:Open Source License

/**
 * Get the PDF Table containing trip information like trip id, date, and destination
 *
 * @returns {@link Table} used for a PDF
 *//*  w  w  w  .  j  a va 2  s  .c  om*/
protected Table getTripInfo() throws BadElementException {
    final Table retval = new Table(3);
    retval.setWidth(100f);
    retval.setBorder(NO_BORDER);
    retval.addCell(getHeaderCell("Trip/Event ID"));

    final Cell dateHeaderCell = getHeaderCell("Date");

    retval.addCell(dateHeaderCell);
    retval.addCell(getHeaderCell("Destination/Event Name"));
    retval.endHeaders();
    retval.addCell(getBorderlessCell(getTripId()));

    final Cell dateCell = getBorderlessCell(getDate());

    retval.addCell(dateCell);
    retval.addCell(getBorderlessCell(getDestination()));
    return retval;
}

From source file:org.kuali.kfs.module.tem.pdf.Coversheet.java

License:Open Source License

/**
 * Get the PDF Table with personal information about the initiator and traveler
 *
 * @returns {@link Table} used for a PDF
 */// ww w .  j  av  a 2  s  . co  m
protected Table getPersonalInfo() throws BadElementException {
    final Table retval = new Table(2);
    retval.setWidth(100f);
    retval.setBorder(NO_BORDER);
    retval.addCell(getHeaderCell("Traveler"));

    final Cell initiatorHeaderCell = getHeaderCell("Request Submitted By");

    retval.addCell(initiatorHeaderCell);
    retval.endHeaders();
    retval.addCell(getTravelerInfo());

    final Cell initiatorCell = getInitiatorInfo();

    retval.addCell(initiatorCell);
    return retval;
}

From source file:org.kuali.kfs.module.tem.pdf.Coversheet.java

License:Open Source License

public Table getExpenses() throws BadElementException {
    final Table retval = new Table(3);
    retval.setWidth(100f);//from www. j a  v  a  2  s. c  o m
    retval.setBorder(NO_BORDER);
    retval.addCell(getHeaderCell("Expenses"));
    retval.addCell(getHeaderCell("Amount"));
    retval.addCell(getHeaderCell("Receipt Required?"));
    retval.endHeaders();

    for (final Map<String, String> expense : expenses) {
        retval.addCell(getBorderlessCell(expense.get("expenseType")));
        retval.addCell(getBorderlessCell(expense.get("amount")));
        retval.addCell(getBorderlessCell(expense.get("receipt")));
    }
    return retval;
}

From source file:org.netxilia.server.rest.pdf.SheetPdfProvider.java

License:Open Source License

/**
 * Initialize the main info holder table.
 * /* www  .j a va 2 s  .c om*/
 * @throws BadElementException
 *             for errors during table initialization
 * @throws NetxiliaBusinessException
 * @throws NetxiliaResourceException
 */
protected Table initTable(ISheet sheet)
        throws BadElementException, NetxiliaResourceException, NetxiliaBusinessException {
    Table tablePDF = new Table(sheet.getDimensions().getNonBlocking().getColumnCount() + 1);
    // tablePDF.setDefaultVerticalAlignment(Element.ALIGN_TOP);
    // tablePDF.setCellsFitPage(true);
    // tablePDF.setWidth(100);

    tablePDF.setPadding(2);
    tablePDF.setSpacing(0);

    return tablePDF;
}