Package com.lowagie.text

Examples of com.lowagie.text.Table


      PdfWriter.getInstance(document,
          new FileOutputStream("MyFirstTable.pdf"));
      // step 3: we open the document
      document.open();
      // step 4: we create a table and add it to the document
      Table table = new Table(2, 2); // 2 rows, 2 columns
      table.addCell("0.0");
      table.addCell("0.1");
      table.addCell("1.0");
      table.addCell("1.1");
      document.add(table);
      document.add(new Paragraph("converted to PdfPTable:"));
      table.setConvert2pdfptable(true);
      document.add(table);
    } catch (DocumentException de) {
      System.err.println(de.getMessage());
    } catch (IOException ioe) {
      System.err.println(ioe.getMessage());
View Full Code Here


    public static Table newDescription(String description) throws DocumentException {
        if ( description == null || "".equals( description ) ) {
            description = " - ";
        }

        Table table = newTable();

        Cell headerCell = newHeaderCell( "Description",
                                         CATEGORIES_TEXT );
        table.addCell( headerCell );

        table.addCell( newCell( description ) );

        return table;
    }
View Full Code Here

        return table;
    }

    private static Table newTable() throws BadElementException {
        Table table = new Table( 1 );

        table.setBorderWidthTop( 1 );
        table.setBorderWidthLeft( 1 );
        table.setBorderWidthRight( 1 );
        table.setBorderWidthBottom( 0 );
        table.setWidth( 100 );
        table.setPadding( 3 );
        table.setAlignment( Table.ALIGN_LEFT );

        return table;
    }
View Full Code Here

        }
    }

    public static Table newRuleTable(DrlRuleParser drl) throws BadElementException,
                                                     DocumentException {
        Table table = newTable();

        Cell headerCell = newHeaderCell( "Attributes",
                                         CATEGORIES_TEXT );
        table.addCell( headerCell );

        for ( String s : drl.getHeader() ) {
            table.addCell( newCell( INDENT + s.trim() ) );
        }

        table.addCell( newHeaderCell( INDENT + "WHEN",
                                      BODY_TEXT ) );
        for ( String s : drl.getLhs() ) {
            table.addCell( newCell( INDENT + INDENT + s.trim() ) );
        }

        table.addCell( newHeaderCell( INDENT + "THEN",
                                      BODY_TEXT ) );
        for ( String s : drl.getRhs() ) {
            table.addCell( newCell( INDENT + INDENT + s.trim() ) );
        }
        // table.addCell( newEmptyWhenThenCell( "END" ) );

        return table;
    }
View Full Code Here

    }

    public static Table newTable(final String topic,
                                 Collection<String> items) throws BadElementException,
                                                          DocumentException {
        Table table = newTable();

        Cell headerCell = newHeaderCell( topic,
                                         CATEGORIES_TEXT );
        table.addCell( headerCell );

        if ( items.isEmpty() ) {
            table.addCell( newCell( " - " ) );
        } else {
            for ( String s : items ) {
                table.addCell( newCell( s ) );
            }
        }

        return table;
    }
View Full Code Here

                p1.add(new Chunk("From the dataset, ",dFont));
                p1.add(new Chunk(makePercentage(Math.round(PRE_validationSetPercentage)),dFont));
                p1.add(new Chunk(" was set aside as a validation set.  Table 1 below shows the sizes of the dataset and the validation set.",dFont));
            }

        Table peopleTable = null;

        if (PRE_validationSetPercentage > 0){peopleTable = new Table(PRE_instances_hold_byClass.length+1,3);} else
        {peopleTable = new Table(PRE_instances_hold_byClass.length+1,2);}
        peopleTable.addCell(new Cell("Subjects/Classifications"), 0, 0);
        peopleTable.addCell(new Cell("Dataset"), 0, 1);
        if (PRE_validationSetPercentage > 0){peopleTable.addCell(new Cell("Validation Dataset"), 0, 2);}


        for (int xx_counter = 0; xx_counter<PRE_instances_hold_byClass.length; xx_counter++){
        peopleTable.addCell(new Cell(PRE_instances_class_names[xx_counter]), xx_counter+1, 0);
        peopleTable.addCell(new Cell(String.valueOf(PRE_instances_learn_byClass[xx_counter])), xx_counter+1, 1);
        if (PRE_validationSetPercentage > 0){peopleTable.addCell(new Cell(String.valueOf(PRE_instances_hold_byClass[xx_counter])), xx_counter+1, 2);}
        }

                            long learn_total_inst =0; long hold_total_inst =0;
                            for (int i = 0; i < PRE_instances_learn_byClass.length; i++) {
                                learn_total_inst += PRE_instances_learn_byClass[i];
                                hold_total_inst += PRE_instances_hold_byClass[i];
                            }

        //Totals row
        peopleTable.addCell(new Cell("Total"), PRE_instances_hold_byClass.length+1,0);
        peopleTable.addCell(new Cell(String.valueOf(learn_total_inst)), PRE_instances_hold_byClass.length+1 ,1);
        if (PRE_validationSetPercentage > 0){peopleTable.addCell(new Cell(String.valueOf(hold_total_inst)), PRE_instances_hold_byClass.length+1 ,2);}

        int[] ee = {220,180,180};
        peopleTable.setWidths(ee);


         // ATTRIBUTE SELECTION AREA
if (attSel){
        p1.add(new Chunk("After the data was converted into an appropriate format, ",dFont));
View Full Code Here

            p2.setSpacingAfter(12);
            p2.setAlignment(Paragraph.ALIGN_JUSTIFIED_ALL);
            p2.add(new Chunk(String.format("Figure %d shows the performance of the classifier when compared to common alternatives:",current_figureNumber++),dFont));
            doc.add(p2);
           
            Table compsTable = new Table(5);
            compsTable.addCell(new Cell("Classifier"), 0, 0);
            compsTable.addCell(new Cell("In-Sample Accuracy"), 0, 1);
            compsTable.addCell(new Cell("In-Sample ROC"), 0, 2);
            compsTable.addCell(new Cell("Validation Set Accuracy"), 0, 3);
            compsTable.addCell(new Cell("Validation Set ROC"), 0, 4);
           
            compsTable.addCell(new Cell("Bayesian Network"), 1, 0);
            compsTable.addCell(new Cell(String.valueOf(toDecimal2(res_pctCorrect_inSample))), 1, 1);
            compsTable.addCell(new Cell(String.valueOf(toDecimal2(100*res_ROC_inSample))), 1, 2);
            compsTable.addCell(new Cell(String.valueOf(toDecimal2(res_pctCorrect_valid))), 1, 3);
            compsTable.addCell(new Cell(String.valueOf(toDecimal2(100*res_ROC_valid))), 1, 4);
           
           
            for (int i = 0; i < comp_names.length; i++){
            compsTable.addCell(new Cell(comp_names[i]), i+2, 0);
            compsTable.addCell(new Cell(String.valueOf(toDecimal2(comp_insample_ACC[i]))), i+2, 1);
            compsTable.addCell(new Cell(String.valueOf(toDecimal2(100*comp_insample_ROC[i]))), i+2, 2);
            compsTable.addCell(new Cell(String.valueOf(toDecimal2(comp_validation_ACC[i]))), i+2, 3);
            compsTable.addCell(new Cell(String.valueOf(toDecimal2(100*comp_validation_ROC[i]))), i+2, 4);
            }
           
            Font ital = new Font();
            ital.setStyle(Font.ITALIC);
            doc.add(new Paragraph("Figure ".concat(String.valueOf(current_figureNumber-1)), ital));
View Full Code Here

            p2.add(new Chunk(String.valueOf(current_figureNumber++),dFont));
                        }
           
            doc.add(p2);

            Table davidTable = new Table(4);

            davidTable.addCell(new Cell("Enrichment Term"), 0, 0);
            davidTable.addCell(new Cell("P-Value"), 0, 1);
            davidTable.addCell(new Cell("Count"), 0, 2);
            davidTable.addCell(new Cell("Percentage"), 0, 3);

           
           
            for (int i = 0; i < Math.min(10,enrArray.length); i++) {
                davidTable.addCell(new Cell(uppercaseLetter(enrArray[i].termName)), i, 0);
                Phrase pval = new Phrase("");
                pval.add(p_valuer_A(String.format("%.2e",enrArray[i].p_value)));
                pval.add(p_valuer_B(String.format("%.2e",enrArray[i].p_value)));
                davidTable.addCell(new Cell(pval), i, 1);
                davidTable.addCell(new Cell(enrArray[i].count), i, 2);
                davidTable.addCell(new Cell(toDecimal2(enrArray[i].percentage)), i, 3);
            }

            Font ital = new Font();
            ital.setStyle(Font.ITALIC);
            doc.add(new Paragraph("Figure ".concat(String.valueOf(current_figureNumber-1)), ital));
View Full Code Here

            doc.add(p1);
           
            Font bo = new Font();
            bo.setStyle(Font.BOLD);
           
            Table pvalTable = new Table(6);
            pvalTable.addCell(new Cell(new Chunk("Name",bo)), 0, 0);
            pvalTable.addCell(new Cell(new Chunk("Entrez",bo)), 0, 1);
            pvalTable.addCell(new Cell(new Chunk("Gene Symbol",bo)), 0, 2);
            pvalTable.addCell(new Cell(new Chunk("P-Value",bo)), 0, 3);
            pvalTable.addCell(new Cell(new Chunk("Fold Change",bo)), 0, 4);
            pvalTable.addCell(new Cell(new Chunk("In Network?",bo)), 0, 5);
           
            for (int i = TTEST_univariate_names.length-1; i > 0; i--) {
                pvalTable.addCell(new Cell(TTEST_univariate_names[i]), i, 0);
                pvalTable.addCell(new Cell(util_lookupFileConvert.tradeProbeIDforEntrez(lookupFileName,TTEST_univariate_names[i])), i, 1);
                pvalTable.addCell(new Cell(util_lookupFileConvert.tradeProbeIDforSymbol(lookupFileName,TTEST_univariate_names[i])), i, 2);
                Phrase pval = new Phrase("");
                pval.add(p_valuer_A(String.format("%.2e",TTEST_univariate_p_value_raw[i])));
                pval.add(p_valuer_B(String.format("%.2e",TTEST_univariate_p_value_raw[i])));
                pvalTable.addCell(new Cell(pval), i, 3);   
                if (TTEST_univariate_fold_change_raw[i]>= 1){
                    pvalTable.addCell(new Cell(String.format("%.2f",TTEST_univariate_fold_change_raw[i])), i, 4);
                } else {
                    pvalTable.addCell(new Cell(String.format("%.2f",-1.00/TTEST_univariate_fold_change_raw[i])), i, 4);
                }
                if (TTEST_univariate_p_value_raw[i]< TTEST_p_value_threshold){
                    pvalTable.addCell(new Cell("In network"), i, 5);
                } else {
                    pvalTable.addCell(new Cell("No"), i, 5);
                }
            }
           
            pvalTable.setCellsFitPage(attSel);
           
            doc.add(pvalTable);
            doc.newPage();
        }
View Full Code Here

    /**
     * Initialize the main info holder table.
     * @throws BadElementException for errors during table initialization
     */
    protected void initTable() throws BadElementException, DocumentException, IOException{
        tablePDF = new Table(this.model.getNumberOfColumns());
        tablePDF.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
        tablePDF.setCellsFitPage(true);
        tablePDF.setWidth(100);

        tablePDF.setPadding(2);
View Full Code Here

TOP

Related Classes of com.lowagie.text.Table

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.