Example usage for com.lowagie.text Element ALIGN_RIGHT

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

Introduction

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

Prototype

int ALIGN_RIGHT

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

Click Source Link

Document

A possible value for paragraph alignment.

Usage

From source file:net.bull.javamelody.internal.web.pdf.PdfCounterReport.java

License:Apache License

private void writeRequest(CounterRequest request) throws BadElementException, IOException {
    getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    addCell(getShortRequestName(request));
    if (includeGraph) {
        writeRequestGraph(request);//w ww  .j  av  a  2s. c  o m
    }
    getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
    final CounterRequest globalRequest = counterRequestAggregation.getGlobalRequest();
    if (counterRequestAggregation.isTimesDisplayed()) {
        addPercentageCell(request.getDurationsSum(), globalRequest.getDurationsSum());
        addCell(integerFormat.format(request.getHits()));
        final int mean = request.getMean();
        addCell(new Phrase(integerFormat.format(mean), getSlaFont(mean)));
        addCell(integerFormat.format(request.getMaximum()));
        addCell(integerFormat.format(request.getStandardDeviation()));
    } else {
        addCell(integerFormat.format(request.getHits()));
    }
    if (counterRequestAggregation.isCpuTimesDisplayed()) {
        addPercentageCell(request.getCpuTimeSum(), globalRequest.getCpuTimeSum());
        final int cpuTimeMean = request.getCpuTimeMean();
        addCell(new Phrase(integerFormat.format(cpuTimeMean), getSlaFont(cpuTimeMean)));
    }
    if (counterRequestAggregation.isAllocatedKBytesDisplayed()) {
        final long allocatedKBytesMean = request.getAllocatedKBytesMean();
        addCell(integerFormat.format(allocatedKBytesMean));
    }
    if (!isErrorAndNotJobCounter()) {
        addCell(systemErrorFormat.format(request.getSystemErrorPercentage()));
    }
    if (counterRequestAggregation.isResponseSizeDisplayed()) {
        addCell(integerFormat.format(request.getResponseSizeMean() / 1024));
    }
    if (counterRequestAggregation.isChildHitsDisplayed()) {
        addCell(integerFormat.format(request.getChildHitsMean()));
        addCell(integerFormat.format(request.getChildDurationsMean()));
    }
}

From source file:net.bull.javamelody.internal.web.pdf.PdfCounterRequestContextReport.java

License:Apache License

private void writeFooter() throws DocumentException {
    final Paragraph footer = new Paragraph(
            getFormattedString("nb_requete_en_cours", integerFormat.format(rootCurrentContexts.size())),
            normalFont);/*from ww  w .  j  a  v  a2  s.c  o  m*/
    footer.setAlignment(Element.ALIGN_RIGHT);
    addToDocument(footer);
}

From source file:net.bull.javamelody.internal.web.pdf.PdfCounterRequestContextReport.java

License:Apache License

private void writeDurations(List<CounterRequestContext> contexts) throws DocumentException, IOException {
    getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);

    final Paragraph paragraph = new Paragraph("", cellFont);
    boolean first = true;
    for (final CounterRequestContext context : contexts) {
        if (!first) {
            paragraph.add(new Chunk('\n', cellFont));
        }// w ww.ja  v a 2  s . co  m
        final int duration = context.getDuration(timeOfSnapshot);
        final Counter parentCounter = context.getParentCounter();
        final PdfCounterReport counterReport = counterReportsByCounterName.get(parentCounter.getName());
        if (parentCounter.getIconName() != null) {
            paragraph.add(new Chunk(getImage(parentCounter.getIconName()), 0, -1));
        }
        final Font slaFont;
        if (counterReport == null) {
            slaFont = infoCellFont;
        } else {
            slaFont = counterReport.getSlaFont(duration);
        }
        paragraph.add(new Phrase(integerFormat.format(duration), slaFont));
        first = false;
    }
    addCell(paragraph);
}

From source file:net.bull.javamelody.internal.web.pdf.PdfDatabaseInformationsReport.java

License:Apache License

private void writeRow(String[] row) {
    final PdfPCell defaultCell = getDefaultCell();
    defaultCell.setVerticalAlignment(Element.ALIGN_TOP);
    for (final String value : row) {
        if (value == null || value.isEmpty()) {
            addCell("");
        } else {// ww w . j  a  v a 2  s. c o m
            if (isNumber(value)) {
                defaultCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
            } else {
                defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
            }
            addCell(value);
        }
    }
}

From source file:net.bull.javamelody.internal.web.pdf.PdfHeapHistogramReport.java

License:Apache License

private void writeClassInfoRow(ClassInfo classInfo, long totalInstances, long totalBytes,
        boolean sourceDisplayed) {
    final PdfPCell defaultCell = getDefaultCell();
    defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    addCell(classInfo.getName());/*from ww w .  java2 s.c  o m*/
    defaultCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    final long bytes = classInfo.getBytes();
    final long instancesCount = classInfo.getInstancesCount();
    addCell(integerFormat.format(bytes / 1024));
    addCell(integerFormat.format(bytes * 100 / totalBytes));
    addCell(integerFormat.format(instancesCount));
    addCell(integerFormat.format(instancesCount * 100 / totalInstances));
    defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    if (sourceDisplayed) {
        final String source = classInfo.getSource();
        if (source == null) {
            addCell("");
        } else {
            addCell(source);
        }
    }
}

From source file:net.bull.javamelody.internal.web.pdf.PdfHotspotsReport.java

License:Apache License

private void writeHotspot(SampledMethod hotspot) {
    final PdfPCell defaultCell = getDefaultCell();
    defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    addCell(hotspot.getClassName() + '.' + hotspot.getMethodName());
    defaultCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    final double percent = 100d * hotspot.getCount() / totalCount;
    addCell(percentFormat.format(percent));
}

From source file:net.bull.javamelody.internal.web.pdf.PdfJobInformationsReport.java

License:Apache License

private void addConfigurationReference() throws DocumentException {
    final Anchor quartzAnchor = new Anchor("Configuration reference", PdfFonts.BLUE.getFont());
    quartzAnchor.setName("Quartz configuration reference");
    quartzAnchor.setReference("http://www.quartz-scheduler.org/docs/index.html");
    quartzAnchor.setFont(PdfFonts.BLUE.getFont());
    final Paragraph quartzParagraph = new Paragraph();
    quartzParagraph.add(quartzAnchor);//  w ww  .  j av a 2s .  co  m
    quartzParagraph.setAlignment(Element.ALIGN_RIGHT);
    addToDocument(quartzParagraph);
}

From source file:net.bull.javamelody.internal.web.pdf.PdfJobInformationsReport.java

License:Apache License

private void writeJobInformations(JobInformations jobInformations) throws BadElementException, IOException {
    final PdfPCell defaultCell = getDefaultCell();
    defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    addCell(jobInformations.getGroup());
    addCell(jobInformations.getName());// w ww . ja v  a  2 s.  c o  m
    addCell(jobInformations.getJobClassName());
    defaultCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    final CounterRequest counterRequest = getCounterRequest(jobInformations);
    // counterRequest ne peut pas tre null ici
    if (counterRequest.getMean() >= 0) {
        addCell(formatDuration(counterRequest.getMean()));
    } else {
        addCell("");
    }
    // rq: on n'affiche pas ici le nb d'excutions, le maximum, l'cart-type
    // ou le pourcentage d'erreurs, uniquement car cela ferait trop de colonnes dans la page
    writeJobTimes(jobInformations, counterRequest);
    defaultCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    if (jobInformations.isPaused()) {
        addCell(getString("oui"));
    } else {
        addCell(getString("non"));
    }
}

From source file:net.bull.javamelody.internal.web.pdf.PdfProcessInformationsReport.java

License:Apache License

private void addPsCommandReference() throws DocumentException {
    final Anchor psAnchor = new Anchor("ps command reference", PdfFonts.BLUE.getFont());
    psAnchor.setName("ps command reference");
    psAnchor.setReference("http://en.wikipedia.org/wiki/Ps_(Unix)");
    psAnchor.setFont(PdfFonts.BLUE.getFont());
    final Paragraph psParagraph = new Paragraph();
    psParagraph.add(psAnchor);/*  w w w  . j  av  a2s .  co m*/
    psParagraph.setAlignment(Element.ALIGN_RIGHT);
    addToDocument(psParagraph);
}

From source file:net.bull.javamelody.internal.web.pdf.PdfProcessInformationsReport.java

License:Apache License

private void writeProcessInformations(ProcessInformations processInformations) {
    final PdfPCell defaultCell = getDefaultCell();
    defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    addCell(processInformations.getUser());
    defaultCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    addCell(integerFormat.format(processInformations.getPid()));
    if (!windows) {
        addCell(percentFormat.format(processInformations.getCpuPercentage()));
        addCell(percentFormat.format(processInformations.getMemPercentage()));
    }/*from w ww  . j a  v  a 2 s  . com*/
    addCell(integerFormat.format(processInformations.getVsz()));
    if (!windows) {
        addCell(integerFormat.format(processInformations.getRss()));
        defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
        addCell(processInformations.getTty());
        addCell(processInformations.getStat());
        defaultCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        addCell(processInformations.getStart());
    }
    addCell(processInformations.getCpuTime());
    defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    addCell(processInformations.getCommand());
}