com.lowagie.text.Phrase.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(11.0k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中com.lowagie.text.Phrase.<init>()方法的一些代码示例,展示了Phrase.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Phrase.<init>()方法的具体详情如下:
包路径:com.lowagie.text.Phrase
类名称:Phrase
方法名:<init>

Phrase.<init>介绍

[英]Constructs a Phrase without specifying a leading.
[中]在不指定前导的情况下构造Phrase

代码示例

代码示例来源:origin: javamelody/javamelody

private void addCell(String string, Font font) {
    currentTable.addCell(new Phrase(string, font));
  }
}

代码示例来源:origin: javamelody/javamelody

private void addCell(String string) {
    currentTable.addCell(new Phrase(string, cellFont));
  }
}

代码示例来源:origin: javamelody/javamelody

private void addCell(String string) {
    currentTable.addCell(new Phrase(string, cellFont));
  }
}

代码示例来源:origin: javamelody/javamelody

void addCell(String string) {
  table.addCell(new Phrase(string, cellFont));
}

代码示例来源:origin: stackoverflow.com

PdfPTable table = new PdfPTable(2);
PdfPCell cellOne = new PdfPCell(new Phrase("Hello"));
PdfPCell cellTwo = new PdfPCell(new Phrase("World"));

cellOne.setBorder(Rectangle.NO_BORDER);
cellOne.setBackgroundColor(new Color(255,255,45));

cellTwo.setBorder(Rectangle.BOX);

table.addCell(cellOne);
table.addCell(cellTwo);

代码示例来源:origin: javamelody/javamelody

table.setWidthPercentage(25);
table.getDefaultCell().setBorderWidth(0);
table.addCell(new Phrase(I18N.getString("Network"), cellFont));
table.addCell(new Phrase(integerFormat.format(networkTimeMean) + " ms ("
    + percentFormat.format(networkPercent) + "%)", cellFont));
table.addCell(new Phrase(I18N.getString("Server"), cellFont));
table.addCell(new Phrase(integerFormat.format(serverMean) + " ms ("
    + percentFormat.format(serverPercent) + "%)", cellFont));
table.addCell(new Phrase(I18N.getString("DOM_processing"), cellFont));
table.addCell(new Phrase(integerFormat.format(domProcessingMean) + " ms ("
    + percentFormat.format(domProcessingPercent) + "%)", cellFont));
table.addCell(new Phrase(I18N.getString("Page_rendering"), cellFont));
table.addCell(new Phrase(integerFormat.format(pageRenderingMean) + " ms ("
    + percentFormat.format(pageRenderingPercent) + "%)", cellFont));
addToDocument(table);
addToDocument(new Phrase("\n", cellFont));

代码示例来源:origin: javamelody/javamelody

private void writeFileDescriptorCounts(JavaInformations javaInformations)
    throws BadElementException, IOException {
  final long unixOpenFileDescriptorCount = javaInformations.getUnixOpenFileDescriptorCount();
  final long unixMaxFileDescriptorCount = javaInformations.getUnixMaxFileDescriptorCount();
  addCell(getString("nb_fichiers") + ':');
  final Phrase fileDescriptorCountPhrase = new Phrase(
      integerFormat.format(unixOpenFileDescriptorCount) + DIVIDE
          + integerFormat.format(unixMaxFileDescriptorCount) + BAR_SEPARATOR,
      cellFont);
  final Image fileDescriptorCountImage = Image.getInstance(
      Bar.toBarWithAlert(javaInformations.getUnixOpenFileDescriptorPercentage()), null);
  fileDescriptorCountImage.scalePercent(50);
  fileDescriptorCountPhrase.add(new Chunk(fileDescriptorCountImage, 0, 0));
  currentTable.addCell(fileDescriptorCountPhrase);
}

代码示例来源:origin: javamelody/javamelody

private void writeHeader() throws DocumentException {
  final List<String> headers = new ArrayList<String>();
  headers.add("Beans");
  headers.addAll(calledBeans);
  final int[] relativeWidths = new int[headers.size()];
  Arrays.fill(relativeWidths, 0, headers.size(), 1);
  relativeWidths[0] = 4;
  final PdfPTable table = new PdfPTable(headers.size());
  table.setWidthPercentage(100);
  table.setWidths(relativeWidths);
  table.setHeaderRows(1);
  final PdfPCell defaultCell = table.getDefaultCell();
  defaultCell.setGrayFill(0.9f);
  defaultCell.setHorizontalAlignment(Element.ALIGN_CENTER);
  defaultCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
  defaultCell.setPaddingLeft(0);
  defaultCell.setPaddingRight(0);
  for (final String header : headers) {
    table.addCell(new Phrase(header, boldCellFont));
    // pas la première entête de colonne
    defaultCell.setRotation(90);
  }
  defaultCell.setRotation(0);
  defaultCell.setPaddingLeft(2);
  defaultCell.setPaddingRight(2);
  currentTable = table;
}

代码示例来源:origin: javamelody/javamelody

private void writeGraph() throws IOException, DocumentException {
  final JRobin jrobin = collector.getJRobin(graphName);
  if (jrobin != null) {
    final byte[] img = jrobin.graph(range, 960, 400);
    final Image image = Image.getInstance(img);
    image.scalePercent(50);
    final PdfPTable table = new PdfPTable(1);
    table.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.setWidthPercentage(100);
    table.getDefaultCell().setBorder(0);
    table.addCell("\n");
    table.addCell(image);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
    table.addCell(new Phrase(getString("graph_units"), cellFont));
    addToDocument(table);
  } else {
    // just in case request is null and collector.getJRobin(graphName) is null, we must write something in the document
    addToDocument(new Phrase("\n", cellFont));
  }
}

代码示例来源:origin: javamelody/javamelody

void initTable(List<String> headers, int[] relativeWidths) throws DocumentException {
  assert headers.size() == relativeWidths.length;
  final PdfPTable mytable = new PdfPTable(headers.size());
  mytable.setWidthPercentage(100);
  mytable.setWidths(relativeWidths);
  mytable.setHeaderRows(1);
  final PdfPCell defaultCell = mytable.getDefaultCell();
  defaultCell.setGrayFill(0.9f);
  defaultCell.setHorizontalAlignment(Element.ALIGN_CENTER);
  defaultCell.setPaddingLeft(0);
  defaultCell.setPaddingRight(0);
  final Font tableHeaderFont = PdfFonts.TABLE_HEADER.getFont();
  for (final String header : headers) {
    mytable.addCell(new Phrase(header, tableHeaderFont));
  }
  defaultCell.setPaddingLeft(2);
  defaultCell.setPaddingRight(2);
  this.table = mytable;
}

代码示例来源:origin: javamelody/javamelody

private void writeServerInfo(String serverInfo) throws BadElementException, IOException {
  addCell(getString("Serveur") + ':');
  final Phrase serverInfoPhrase = new Phrase("", cellFont);
  final String applicationServerIconName = HtmlJavaInformationsReport
      .getApplicationServerIconName(serverInfo);
  if (applicationServerIconName != null) {
    final Image applicationServerImage = PdfDocumentFactory
        .getImage("servers/" + applicationServerIconName);
    applicationServerImage.scalePercent(40);
    serverInfoPhrase.add(new Chunk(applicationServerImage, 0, 0));
    serverInfoPhrase.add("   ");
  }
  serverInfoPhrase.add(serverInfo);
  currentTable.addCell(serverInfoPhrase);
}

代码示例来源:origin: stackoverflow.com

PdfPCell c1 = new PdfPCell(new Phrase("Job Name:"));
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(c1);
c1 = new PdfPCell(new Phrase("Test 001"));
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(c1);
c1 = new PdfPCell(new Phrase(""));
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(c1);
table.setHeaderRows(1);

代码示例来源:origin: javamelody/javamelody

private void writeMemoryInformations(MemoryInformations memoryInformations)
    throws BadElementException, IOException {
  addCell(memoryInformations.getMemoryDetails().replace(" Mo", ' ' + getString("Mo")));
  final long usedPermGen = memoryInformations.getUsedPermGen();
  if (usedPermGen > 0) {
    // perm gen est à 0 sous jrockit
    final long maxPermGen = memoryInformations.getMaxPermGen();
    addCell(getString("Memoire_Perm_Gen") + ':');
    if (maxPermGen > 0) {
      final Phrase permGenPhrase = new Phrase(
          integerFormat.format(usedPermGen / 1024 / 1024) + ' ' + getString("Mo")
              + DIVIDE + integerFormat.format(maxPermGen / 1024 / 1024) + ' '
              + getString("Mo") + BAR_SEPARATOR,
          cellFont);
      final Image permGenImage = Image.getInstance(
          Bar.toBarWithAlert(memoryInformations.getUsedPermGenPercentage()), null);
      permGenImage.scalePercent(50);
      permGenPhrase.add(new Chunk(permGenImage, 0, 0));
      currentTable.addCell(permGenPhrase);
    } else {
      addCell(integerFormat.format(usedPermGen / 1024 / 1024) + ' ' + getString("Mo"));
    }
  }
}

代码示例来源:origin: javamelody/javamelody

final Phrase phrase = new Phrase(getString("busyThreads") + equal
    + integerFormat.format(currentThreadsBusy) + DIVIDE
    + integerFormat.format(tomcatInformations.getMaxThreads()) + BAR_SEPARATOR,
    + getString("maxProcessingTime") + equal
    + integerFormat.format(tomcatInformations.getMaxTime())));
currentTable.addCell(phrase);

代码示例来源:origin: javamelody/javamelody

private void writeSummary(JavaInformations javaInformations)
    throws BadElementException, IOException {
  addCell(getString("Host") + ':');
  currentTable.addCell(new Phrase(javaInformations.getHost(), boldCellFont));
  addCell(getString("memoire_utilisee") + ':');
  final MemoryInformations memoryInformations = javaInformations.getMemoryInformations();
  final long usedMemory = memoryInformations.getUsedMemory();
  final long maxMemory = memoryInformations.getMaxMemory();
  final Phrase memoryPhrase = new Phrase(integerFormat.format(usedMemory / 1024 / 1024) + ' '
      + getString("Mo") + DIVIDE + integerFormat.format(maxMemory / 1024 / 1024) + ' '
      + getString("Mo") + BAR_SEPARATOR, cellFont);
      addCell(integerFormat.format(usedConnectionCount));
    } else {
      final Phrase usedConnectionCountPhrase = new Phrase(
          integerFormat.format(usedConnectionCount) + DIVIDE
              + integerFormat.format(maxConnectionCount) + BAR_SEPARATOR,
      usedConnectionCountImage.scalePercent(50);
      usedConnectionCountPhrase.add(new Chunk(usedConnectionCountImage, 0, 0));
      currentTable.addCell(usedConnectionCountPhrase);
    final Phrase systemCpuLoadPhrase = new Phrase(
        decimalFormat.format(javaInformations.getSystemCpuLoad()) + BAR_SEPARATOR,
        cellFont);

代码示例来源:origin: javamelody/javamelody

private void writeDetails(JavaInformations javaInformations)
    throws BadElementException, IOException {
  addCell(getString("OS") + ':');
  final Phrase osPhrase = new Phrase("", cellFont);
  final String osIconName = HtmlJavaInformationsReport
      .getOSIconName(javaInformations.getOS());
  currentTable.addCell(osPhrase);
  addCell(getString("Java") + ':');
  addCell(javaInformations.getJavaVersion());
  addCell(getString("JVM") + ':');
  final Phrase jvmVersionPhrase = new Phrase(javaInformations.getJvmVersion(), cellFont);
  if (javaInformations.getJvmVersion().contains("Client")) {
    jvmVersionPhrase.add(separator);
    jvmVersionPhrase.add(new Chunk(alertImage, 0, -2));
  currentTable.addCell(jvmVersionPhrase);
  addCell(getString("PID") + ':');
  addCell(javaInformations.getPID());

代码示例来源:origin: stackoverflow.com

PdfPTable tbl = new PdfPTable(2);
PdfPCell cell = new PdfPCell(new Phrase("1."));
cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
cell.disableBorderSide(Rectangle.BOX);
tbl.addCell(cell);
cell = new PdfPCell(new Phrase("some random text"));
cell.disableBorderSide(Rectangle.BOX);
tbl.addCell(cell);
cell = new PdfPCell(new Phrase("34."));
cell.disableBorderSide(Rectangle.BOX);
cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
tbl.addCell(cell);
cell = new PdfPCell(new Phrase("some more random text"));
cell.disableBorderSide(Rectangle.BOX);
tbl.addCell(cell);

代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext

/**
 * Adds a cell element.
 * 
 * @param text the text for the cell
 */    
public void addCell(String text) {
  addCell(new Phrase(text));
}

代码示例来源:origin: com.github.librepdf/openpdf

/**
 * Adds a cell element.
 * 
 * @param text the text for the cell
 */    
public void addCell(String text) {
  addCell(new Phrase(text));
}

代码示例来源:origin: fr.opensagres.xdocreport.itext-gae/itext-gae

/**
 * Adds a cell element.
 * 
 * @param text the text for the cell
 */    
public void addCell(String text) {
  addCell(new Phrase(text));
}

相关文章