private void writeGraphDetails() throws IOException, DocumentException { if (collector.isStopped()) { return; } final PdfPTable jrobinTable = new PdfPTable(1); jrobinTable.setHorizontalAlignment(Element.ALIGN_CENTER); jrobinTable.setWidthPercentage(100); jrobinTable.getDefaultCell().setBorder(0); if (largeGraphs != null) { // si les graphiques ont été préinitialisés (en Swing) alors on les utilise for (final byte[] imageData : largeGraphs.values()) { final Image image = Image.getInstance(imageData); jrobinTable.addCell(image); } } else { final Collection<JRobin> counterJRobins = collector.getDisplayedCounterJRobins(); if (counterJRobins.isEmpty()) { return; } for (final JRobin jrobin : counterJRobins) { // la hauteur de l'image est prévue pour qu'il n'y ait pas de graph seul sur une page final Image image = Image.getInstance(jrobin.graph(range, LARGE_GRAPH_WIDTH, LARGE_GRAPH_HEIGHT)); jrobinTable.addCell(image); } } newPage(); addToDocument(jrobinTable); newPage(); }
@Override void toPdf() throws IOException, DocumentException { addParagraph(buildSummary(), "systemmonitor.png"); writeGraphs(collector.getDisplayedCounterJRobins(), smallGraphs); final List<Counter> counters = collector.getRangeCountersToBeDisplayed(counterRange); final List<PdfCounterReport> pdfCounterReports = writeCounters(counters); final List<PdfCounterRequestContextReport> pdfCounterRequestContextReports = new ArrayList<PdfCounterRequestContextReport>(); if (!collectorServer) { addParagraph(getString("Requetes_en_cours"), "hourglass.png"); // si on n'est pas sur le serveur de collecte il n'y a qu'un javaInformations pdfCounterRequestContextReports.addAll( writeCurrentRequests(javaInformationsList.get(0), counters, pdfCounterReports)); } addToDocument(new Phrase("\n", normalFont)); addParagraph(getString("Informations_systemes"), "systeminfo.png"); new PdfJavaInformationsReport(javaInformationsList, getDocument()).toPdf(); addParagraph(getString("Threads"), "threads.png"); writeThreads(false); PdfCounterReport pdfJobCounterReport = null; Counter rangeJobCounter = null; if (isJobEnabled()) { rangeJobCounter = collector.getRangeCounter(counterRange, Counter.JOB_COUNTER_NAME); addToDocument(new Phrase("\n", normalFont)); addParagraph(getString("Jobs"), "jobs.png"); writeJobs(rangeJobCounter, false); pdfJobCounterReport = writeCounter(rangeJobCounter); } if (isCacheEnabled()) { addToDocument(new Phrase("\n", normalFont)); addParagraph(getString("Caches"), "caches.png"); writeCaches(false); } newPage(); addParagraph(getString("Statistiques_detaillees"), "systemmonitor.png"); writeGraphs(collector.getDisplayedOtherJRobins(), smallOtherGraphs); writeGraphDetails(); writeCountersDetails(pdfCounterReports); if (!collectorServer) { addParagraph(getString("Requetes_en_cours_detaillees"), "hourglass.png"); // si on n'est pas sur le serveur de collecte il n'y a qu'un javaInformations writeCurrentRequestsDetails(pdfCounterRequestContextReports); } addParagraph(getString("Informations_systemes_detaillees"), "systeminfo.png"); new PdfJavaInformationsReport(javaInformationsList, getDocument()).writeInformationsDetails(); addParagraph(getString("Threads_detailles"), "threads.png"); writeThreads(true); if (isJobEnabled()) { addToDocument(new Phrase("\n", normalFont)); addParagraph(getString("Jobs_detailles"), "jobs.png"); writeJobs(rangeJobCounter, true); writeCounterDetails(pdfJobCounterReport); } if (isCacheEnabled()) { addToDocument(new Phrase("\n", normalFont)); addParagraph(getString("Caches_detailles"), "caches.png"); writeCaches(true); } writeDurationAndOverhead(); }