本文整理了Java中com.lowagie.text.Phrase.add()
方法的一些代码示例,展示了Phrase.add()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Phrase.add()
方法的具体详情如下:
包路径:com.lowagie.text.Phrase
类名称:Phrase
方法名:add
[英]Adds a Chunk
, an Anchor
or another Phrase
to this Phrase
.
[中]向该Phrase
添加Chunk
、Anchor
或另一个Phrase
。
代码示例来源: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: javamelody/javamelody
private void writeJndiBinding(JndiBinding jndiBinding) throws BadElementException, IOException {
final PdfPCell defaultCell = getDefaultCell();
defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
final String name = jndiBinding.getName();
final String className = jndiBinding.getClassName();
final String contextPath = jndiBinding.getContextPath();
final String value = jndiBinding.getValue();
if (contextPath != null) {
final Image image = getFolderImage();
final Phrase phrase = new Phrase("", cellFont);
phrase.add(new Chunk(image, 0, 0));
phrase.add(" ");
phrase.add(name);
addCell(phrase);
} else {
addCell(name);
}
addCell(className != null ? className : "");
addCell(value != null ? value : "");
}
代码示例来源: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
100d * currentThreadsBusy / tomcatInformations.getMaxThreads()), null);
threadsImage.scalePercent(50);
phrase.add(new Chunk(threadsImage, 0, 0));
phrase.add(new Chunk('\n' + getString("bytesReceived") + equal
+ integerFormat.format(tomcatInformations.getBytesReceived()) + '\n'
+ getString("bytesSent") + equal
代码示例来源: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
.getInstance(Bar.toBar(100d * elapsedTime / counterRequest.getMean()), null);
memoryImage.scalePercent(47);
elapsedTimePhrase.add("\n");
elapsedTimePhrase.add(new Chunk(memoryImage, 0, 0));
addCell(elapsedTimePhrase);
} else {
代码示例来源:origin: javamelody/javamelody
Bar.toBarWithAlert(memoryInformations.getUsedMemoryPercentage()), null);
memoryImage.scalePercent(50);
memoryPhrase.add(new Chunk(memoryImage, 0, 0));
currentTable.addCell(memoryPhrase);
if (javaInformations.getSessionCount() >= 0) {
Bar.toBarWithAlert(javaInformations.getUsedConnectionPercentage()), null);
usedConnectionCountImage.scalePercent(50);
usedConnectionCountPhrase.add(new Chunk(usedConnectionCountImage, 0, 0));
currentTable.addCell(usedConnectionCountPhrase);
.getInstance(Bar.toBarWithAlert(javaInformations.getSystemCpuLoad()), null);
systemCpuLoadImage.scalePercent(50);
systemCpuLoadPhrase.add(new Chunk(systemCpuLoadImage, 0, 0));
currentTable.addCell(systemCpuLoadPhrase);
代码示例来源:origin: javamelody/javamelody
final Image osImage = PdfDocumentFactory.getImage("servers/" + osIconName);
osImage.scalePercent(40);
osPhrase.add(new Chunk(osImage, 0, 0));
osPhrase.add(separator);
osPhrase.add(javaInformations.getOS() + " (" + javaInformations.getAvailableProcessors()
+ ' ' + getString("coeurs") + ')');
currentTable.addCell(osPhrase);
final Phrase jvmVersionPhrase = new Phrase(javaInformations.getJvmVersion(), cellFont);
if (javaInformations.getJvmVersion().contains("Client")) {
jvmVersionPhrase.add(separator);
final Image alertImage = PdfDocumentFactory.getImage("alert.png");
alertImage.scalePercent(50);
jvmVersionPhrase.add(new Chunk(alertImage, 0, -2));
代码示例来源:origin: org.jboss.seam/jboss-seam-pdf
@Override
public void handleAdd(Object other)
{
if (after == null)
{
before.add(other);
}
else
{
after.add(other);
}
}
代码示例来源:origin: stackoverflow.com
Phrase phraseHeader = new Phrase();
phraseHeader.add(
new Chunk("Registration Form ",
FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLD)));
phraseHeader.add(
new Chunk(registrationForm.getRegistrationDate(),
FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD)));
Paragraph paragraph = new Paragraph(phraseHeader);
代码示例来源:origin: stackoverflow.com
Image dog = Image.getInstance(DOG);
Image fox = Image.getInstance(FOX);
Phrase p = new Phrase("quick brown fox jumps over the lazy dog.");
p.add("Or, to say it in a more colorful way: quick brown ");
p.add(new Chunk(fox, 0, 0, true));
p.add(" jumps over the lazy ");
p.add(new Chunk(dog, 0, 0, true));
p.add(".");
ColumnText ct = new ColumnText(writer.getDirectContent());
ct.setSimpleColumn(new Rectangle(50, 600, 400, 800));
ct.addText(p);
ct.go();
代码示例来源:origin: fr.opensagres.xdocreport/org.odftoolkit.odfdom.converter.pdf
public void addElement( Element element )
{
// in function add(Element element) chunks are cloned
// it is not correct for chunks with dynamic content (ie page number)
// use function add(int index, Element element) because in this function chunks are added without cloning
super.add( size(), element );
}
代码示例来源:origin: stackoverflow.com
public Phrase createPhrase(String path) throws IOException {
Phrase p = new Phrase();
BufferedReader in = new BufferedReader(
new InputStreamReader(new FileInputStream(path), "UTF8"));
String str;
while ((str = in.readLine()) != null) {
p.add(str);
}
in.close();
return p;
}
代码示例来源:origin: fr.opensagres.xdocreport/fr.opensagres.odfdom.converter.pdf
public void addElement( Element element )
{
// in function add(Element element) chunks are cloned
// it is not correct for chunks with dynamic content (ie page number)
// use function add(int index, Element element) because in this function chunks are added without cloning
super.add( size(), element );
}
代码示例来源:origin: stackoverflow.com
Phrase phrase = new Phrase();
phrase.add("The founders of iText are nominated for a ");
Chunk chunk = new Chunk("European Business Award!");
chunk.setAnchor("http://itextpdf.com/blog/european-business-award-kick-ceremony");
phrase.add(chunk);
table.addCell(phrase);
代码示例来源:origin: stackoverflow.com
Chunk reportTitle= new Chunk("Candidate Login Report ",catFont);
Chunk divisiontitle = new Chunk("Division : \t\t"+divisionName);
Phrase phrase = new Phrase();
phrase.add(reportTitle);
phrase.add(divisiontitle);
Paragraph para = new Paragraph();
para.add(phrase);
para.setAlignment(Element.ALIGN_RIGHT);
代码示例来源:origin: stackoverflow.com
Phrase phrase = new Phrase("Ciao Baby",RESTNAME);
BarcodeQRCode qrcode = new BarcodeQRCode("http://www.tvfoodmaps.com", 72, 72, null);
Image img = qrcode.getImage();
img.scaleToFit(32,32);
phrase.add(new Phrase(new Chunk(img, 0, 0)));
cell.addElement(phrase);
代码示例来源:origin: stackoverflow.com
Image image = Image.getInstance(IMG);
image.setScaleToFitHeight(false);
PdfPTable table = new PdfPTable(1);
table.setTotalWidth(new float[]{120});
table.setLockedWidth(true);
Phrase listOfDots = new Phrase();
for (int i = 0; i < 40; i++) {
listOfDots.add(new Chunk(image, 0, 0));
listOfDots.add(new Chunk(" "));
}
table.addCell(listOfDots);
代码示例来源:origin: org.seasar.tuigwaa/tuigwaa-cms
public Object visit(WikiDeleteline node, Object data) {
Properties props = PdfUtils.getDefaultfontProperties(defaultFont_);
props.setProperty(ElementTags.STYLE, MarkupTags.CSS_LINETHROUGH);
// font-style propagation
Phrase p = new Phrase(props);
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
p.add(node.jjtGetChild(i).jjtAccept(this, data));
}
return p;
}
代码示例来源:origin: org.seasar.tuigwaa/tuigwaa-cms
private Phrase getChildPhrase(SimpleNode node, Object data, int idx) {
Phrase p = new Phrase();
for (int i = idx; i < node.jjtGetNumChildren(); i++) {
p.add(node.jjtGetChild(i).jjtAccept(this, data));
}
return p;
}
内容来源于网络,如有侵权,请联系作者删除!