Example usage for com.lowagie.text Element ALIGN_JUSTIFIED

List of usage examples for com.lowagie.text Element ALIGN_JUSTIFIED

Introduction

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

Prototype

int ALIGN_JUSTIFIED

To view the source code for com.lowagie.text Element ALIGN_JUSTIFIED.

Click Source Link

Document

A possible value for paragraph alignment.

Usage

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.area.AreaDRResultsController.java

/**
 * Overview of Report: experiment and project numbers + some details.
 *///from   w  ww. jav  a 2s  .  c o m
@Override
protected void addOverview() {
    String title = "CellMissy - DOSE RESPONSE ANALYSIS REPORT - EXPERIMENT " + experiment + " - " + "PROJECT "
            + experiment.getProject();
    PdfUtils.addTitle(document, title, titleFont);
    PdfUtils.addEmptyLines(document, 1);
    // add information on dataset (algorithm) and imaging type analyzed
    List<String> lines = new ArrayList<>();
    String line = "DATASET: " + doseResponseController.getSelectedAlgorithm();
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    // add conditions number
    lines.clear();
    line = "NUMBER OF BIOLOGICAL CONDITIONS: "
            + doseResponseController.getdRAnalysisGroup().getVelocitiesMap().size();
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    lines.clear();
    line = "DRUG ANALYSED: " + doseResponseController.getdRAnalysisGroup().getTreatmentToAnalyse();
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    PdfUtils.addEmptyLines(document, 1);
}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.area.AreaDRResultsController.java

/**
 * Add information on the initial fitting: parameters constrained Y/N +
 * values, table with statistical values and the graphical plot
 *///from   ww  w  . j ava2  s .c om
@Override
protected void addInitialFittingInfo() {
    //add title before the table
    PdfUtils.addTitle(document, "INITIAL FIT", boldFont);
    PdfUtils.addEmptyLines(document, 1);
    List<Double> constrainValues = doseResponseController.getConstrainValues(false);
    List<String> lines = new ArrayList<>();
    String parameters = "BOTTOM = ";
    if (constrainValues.get(0) == null) {
        parameters += "--";
    } else {
        parameters += constrainValues.get(0);
    }
    parameters += "    TOP = ";
    if (constrainValues.get(1) == null) {
        parameters += "--";
    } else {
        parameters += constrainValues.get(1);
    }
    String line = "CONSTRAINED PARAMETERS:   " + parameters;
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    lines.clear();
    line = "R SQUARED (GOODNESS OF FIT) = " + AnalysisUtils.roundThreeDecimals(doseResponseController
            .getdRAnalysisGroup().getDoseResponseAnalysisResults().getStatistics(false).getGoodnessOfFit());
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    //add table with statistical values
    PdfPTable initialFittingInfoTable = createFittingInfoTable(false);
    addTable(initialFittingInfoTable);
    PdfUtils.addEmptyLines(document, 1);
    //add graphical plot
    addImageFromChart(
            doseResponseController.createDoseResponseChart(doseResponseController.getDataToFit(false), false),
            chartWidth, chartHeight);
}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.area.AreaDRResultsController.java

/**
 * Add information on the initial fitting: normalization settings + values,
 * parameters constrained Y/N, table with statistical values and the
 * graphical plot//  w w  w.  j  ava2 s .  c o  m
 */
@Override
protected void addNormalizedFittingInfo() {
    //add title before the table
    PdfUtils.addTitle(document, "NORMALIZED FIT", boldFont);
    PdfUtils.addEmptyLines(document, 1);
    List<Double> constrainValues = doseResponseController.getConstrainValues(true);
    List<String> lines = new ArrayList<>();
    //add information about normalization
    lines.add(doseResponseController.getNormalizationInfo());
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    lines.clear();
    //add information about constraining
    String parameters = "BOTTOM = ";
    if (constrainValues.get(0) == null) {
        parameters += "--";
    } else {
        parameters += constrainValues.get(0);
    }
    parameters += "    TOP = ";
    if (constrainValues.get(1) == null) {
        parameters += "--";
    } else {
        parameters += constrainValues.get(1);
    }
    String line = "CONSTRAINED PARAMETERS:   " + parameters;
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    lines.clear();
    line = "R SQUARED (GOODNESS OF FIT) = " + AnalysisUtils.roundThreeDecimals(doseResponseController
            .getdRAnalysisGroup().getDoseResponseAnalysisResults().getStatistics(true).getGoodnessOfFit());
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    //add table with statistical values
    PdfPTable normalizedFittingInfoTable = createFittingInfoTable(true);
    addTable(normalizedFittingInfoTable);
    PdfUtils.addEmptyLines(document, 1);
    //add graphical plot
    addImageFromChart(
            doseResponseController.createDoseResponseChart(doseResponseController.getDataToFit(true), true),
            chartWidth, chartHeight);
}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.generic.GenericDRResultsController.java

@Override
protected void addOverview() {
    String title = "CellMissy - DOSE RESPONSE ANALYSIS REPORT - EXPERIMENT "
            + doseResponseController.getImportedDRDataHolder().getExperimentNumber() + " - "
            + doseResponseController.getImportedDRDataHolder().getExperimentTitle();
    PdfUtils.addTitle(document, title, titleFont);
    PdfUtils.addEmptyLines(document, 1);
    // add information on dataset (algorithm) and imaging type analyzed
    List<String> lines = new ArrayList<>();
    String line = "DATASET: " + doseResponseController.getImportedDRDataHolder().getDataset();
    lines.add(line);//ww  w . j a v a 2 s .  co  m
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    // add conditions number
    lines.clear();
    line = "NUMBER OF BIOLOGICAL CONDITIONS: "
            + doseResponseController.getdRAnalysisGroup().getDoseResponseData().size();
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    lines.clear();
    // add purpose
    line = "PURPOSE: " + doseResponseController.getImportedDRDataHolder().getPurpose();
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    lines.clear();
    // add cell line
    line = "CELL LINE: " + doseResponseController.getImportedDRDataHolder().getCellLine();
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    lines.clear();
    // add treatment
    line = "TREATMENT: " + doseResponseController.getImportedDRDataHolder().getTreatmentName();
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    lines.clear();
    // add assay type
    line = "ASSAY TYPE: " + doseResponseController.getImportedDRDataHolder().getAssayType();
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    lines.clear();
    // add plate format
    line = "PLATE FORMAT: " + doseResponseController.getImportedDRDataHolder().getPlateFormat();
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    PdfUtils.addEmptyLines(document, 1);
}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.generic.GenericDRResultsController.java

@Override
protected void addInitialFittingInfo() {
    //add title before the table
    PdfUtils.addTitle(document, "INITIAL FIT", boldFont);
    PdfUtils.addEmptyLines(document, 1);
    List<Double> constrainValues = doseResponseController.getConstrainValues(false);
    List<String> lines = new ArrayList<>();
    String parameters = "BOTTOM = ";
    if (constrainValues.get(0) == null) {
        parameters += "--";
    } else {/*from   w  w w  .j a v  a  2 s. c o m*/
        parameters += constrainValues.get(0);
    }
    parameters += "    TOP = ";
    if (constrainValues.get(1) == null) {
        parameters += "--";
    } else {
        parameters += constrainValues.get(1);
    }
    String line = "CONSTRAINED PARAMETERS:   " + parameters;
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    lines.clear();
    line = "R SQUARED (GOODNESS OF FIT) = " + AnalysisUtils.roundThreeDecimals(doseResponseController
            .getdRAnalysisGroup().getDoseResponseAnalysisResults().getStatistics(false).getGoodnessOfFit());
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    //add table with statistical values
    PdfPTable initialFittingInfoTable = createFittingInfoTable(false);
    addTable(initialFittingInfoTable);
    PdfUtils.addEmptyLines(document, 1);
    //add graphical plot
    addImageFromChart(
            doseResponseController.createDoseResponseChart(doseResponseController.getDataToFit(false), false),
            chartWidth, chartHeight);
}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.generic.GenericDRResultsController.java

@Override
protected void addNormalizedFittingInfo() {
    //add title before the table
    PdfUtils.addTitle(document, "NORMALIZED FIT", boldFont);
    PdfUtils.addEmptyLines(document, 1);
    List<Double> constrainValues = doseResponseController.getConstrainValues(true);
    List<String> lines = new ArrayList<>();
    //add information about normalization
    lines.add(doseResponseController.getNormalizationInfo());
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    lines.clear();//from ww w  .j av a  2  s .c om
    //add information about constraining
    String parameters = "BOTTOM = ";
    if (constrainValues.get(0) == null) {
        parameters += "--";
    } else {
        parameters += constrainValues.get(0);
    }
    parameters += "    TOP = ";
    if (constrainValues.get(1) == null) {
        parameters += "--";
    } else {
        parameters += constrainValues.get(1);
    }
    String line = "CONSTRAINED PARAMETERS:   " + parameters;
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    lines.clear();
    line = "R SQUARED (GOODNESS OF FIT) = " + AnalysisUtils.roundThreeDecimals(doseResponseController
            .getdRAnalysisGroup().getDoseResponseAnalysisResults().getStatistics(true).getGoodnessOfFit());
    lines.add(line);
    PdfUtils.addText(document, lines, false, Element.ALIGN_JUSTIFIED, bodyFont);
    PdfUtils.addEmptyLines(document, 1);
    //add table with statistical values
    PdfPTable normalizedFittingInfoTable = createFittingInfoTable(true);
    addTable(normalizedFittingInfoTable);
    PdfUtils.addEmptyLines(document, 1);
    //add graphical plot
    addImageFromChart(
            doseResponseController.createDoseResponseChart(doseResponseController.getDataToFit(true), true),
            chartWidth, chartHeight);
}

From source file:classroom.filmfestival_c.Movies25.java

@SuppressWarnings("unchecked")
public static boolean addText(String s, PdfContentByte canvas, float[] f, float size, boolean simulate)
        throws DocumentException, IOException {
    StyleSheet styles = new StyleSheet();
    styles.loadTagStyle("p", "size", size + "px");
    styles.loadTagStyle("p", "align", "justify");
    styles.loadTagStyle("p", "hyphenation", "en_us");
    ArrayList<Element> objects = HTMLWorker.parseToList(new StringReader(s), styles, null);
    ColumnText ct = new ColumnText(canvas);
    ct.setAlignment(Element.ALIGN_JUSTIFIED);
    ct.setLeading(size * 1.2f);//  w ww  . ja  v a2s .c  o m
    ct.setSimpleColumn(f[1] + 2, f[2] + 2, f[3] - 2, f[4]);
    for (Element element : objects) {
        ct.addElement(element);
    }
    return ColumnText.hasMoreText(ct.go(simulate));
}

From source file:com.aryjr.nheengatu.util.GraphicsState.java

License:Open Source License

private static int getiTextAlign(final String align) {
    // TODO align and valign together
    try {/*w ww  .ja  v a 2 s.  c o  m*/
        if (align.equalsIgnoreCase("JUSTIFY"))
            return Element.ALIGN_JUSTIFIED;
        else
            return Element.class.getField("ALIGN_" + align.toUpperCase()).getInt(null);
    } catch (final Exception e) {
        e.printStackTrace();
        return -1;
    }
}

From source file:com.aurel.track.util.PdfUtils.java

License:Open Source License

public static void createPdfFromText(StringBuilder text, File pdfFile) {
    Document output = null;/* w  w w .ja  v  a2  s  .  com*/
    try {
        BufferedReader input = new BufferedReader(new StringReader(text.toString()));
        // Size DIN A4
        //    see com.lowagie.text.PageSize for a complete list of page-size constants.
        output = new Document(PageSize.A4, 40, 40, 40, 40);
        float fntSize, lineSpacing;
        fntSize = 9f;
        lineSpacing = 11f;
        Font font1 = FontFactory.getFont(FontFactory.COURIER, fntSize);
        Font font2 = FontFactory.getFont(FontFactory.COURIER, fntSize);
        font2.setColor(Color.BLUE);
        Font font3 = FontFactory.getFont(FontFactory.COURIER, fntSize);
        font3.setColor(Color.RED);

        PdfWriter.getInstance(output, new FileOutputStream(pdfFile));

        output.open();
        output.addAuthor("Steinbeis");
        output.addSubject("Debug Info");
        output.addTitle(pdfFile.getName());

        String line = "";
        while (null != (line = input.readLine())) {
            Font ft = font1;
            if (line.startsWith("%")) {
                ft = font2;
            }
            if (line.startsWith("% ^^^") || line.startsWith("% vvv")) {
                ft = font3;
            }
            Paragraph p = new Paragraph(lineSpacing, line, ft);
            p.setAlignment(Element.ALIGN_JUSTIFIED);
            output.add(p);
        }
        output.close();
        input.close();
    } catch (Exception e) {
        LOGGER.debug("Problem creating debug info pdf file", e);
    }
}

From source file:com.bibisco.export.ITextExporter.java

License:GNU General Public License

@Override
public void startParagraph(ParagraphAligment pParagraphAligment, boolean pBlnParagraphIndent) {

    mLog.debug("Start startParagraph()");

    mParagraph = new Paragraph(22);
    if (pBlnParagraphIndent) {
        mParagraph.setFirstLineIndent(PARAGRAPH_FIRST_LINE_INDENT);
    } else {//from ww w  . ja  v a 2  s.  c  om
        mParagraph.setFirstLineIndent(0);
    }

    switch (pParagraphAligment) {
    case LEFT:
        mParagraph.setAlignment(Element.ALIGN_LEFT);
        break;
    case CENTER:
        mParagraph.setAlignment(Element.ALIGN_CENTER);
        break;
    case RIGHT:
        mParagraph.setAlignment(Element.ALIGN_RIGHT);
        break;
    case JUSTIFY:
        mParagraph.setAlignment(Element.ALIGN_JUSTIFIED);
        break;

    default:
        break;
    }

    mLog.debug("End startParagraph()");
}