当前位置: 首页>>代码示例>>Java>>正文


Java Phrase.add方法代码示例

本文整理汇总了Java中com.lowagie.text.Phrase.add方法的典型用法代码示例。如果您正苦于以下问题:Java Phrase.add方法的具体用法?Java Phrase.add怎么用?Java Phrase.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.lowagie.text.Phrase的用法示例。


在下文中一共展示了Phrase.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPhrase

import com.lowagie.text.Phrase; //导入方法依赖的package包/类
/**
 * Creates a Phrase object based on a list of properties.
 * @param attributes
 * @return a Phrase
 */
public static Phrase getPhrase(Properties attributes) {
	Phrase phrase = new Phrase();
	phrase.setFont(FontFactory.getFont(attributes));
	String value;
	value = attributes.getProperty(ElementTags.LEADING);
	if (value != null) {
		phrase.setLeading(Float.parseFloat(value + "f"));
	}
	value = attributes.getProperty(Markup.CSS_KEY_LINEHEIGHT);
	if (value != null) {
		phrase.setLeading(Markup.parseLength(value,
				Markup.DEFAULT_FONT_SIZE));
	}
	value = attributes.getProperty(ElementTags.ITEXT);
	if (value != null) {
		Chunk chunk = new Chunk(value);
		if ((value = attributes.getProperty(ElementTags.GENERICTAG)) != null) {
			chunk.setGenericTag(value);
		}
		phrase.add(chunk);
	}
	return phrase;
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:29,代码来源:ElementFactory.java

示例2: handleParentNote

import com.lowagie.text.Phrase; //导入方法依赖的package包/类
/**
 * Checks if there is a parent post.
 *
 * @param post
 *            The post.
 * @param locale
 *            The locale.
 * @param dateFormatter
 *            Date formatter.
 * @param resourcesManager
 *            The used ResourceManager.
 *
 * @param phrase
 *            The phrase to add the information.
 */
private void handleParentNote(NoteData post, Locale locale, DateFormat dateFormatter,
        ResourceBundleManager resourcesManager, Phrase phrase) {
    if (post.getParent() == null) {
        return;
    }
    phrase.add(RtfElementFactory.createChunk("\n", FONT_META_INFORMATION));
    phrase.add(RtfElementFactory.createChunk(
            resourcesManager.getText("export.post.title.reply.prefix", locale) + ": ",
            FONT_META_INFORMATION));
    String fromAt = resourcesManager.getText("blog.post.list.reply.link", locale, post
            .getParent().getUser().getFirstName()
            + " "
            + post.getParent().getUser().getLastName()
            + " ("
            + post.getParent().getUser().getAlias() + ")",
            dateFormatter.format(post.getParent().getCreationDate()));
    phrase.add(RtfElementFactory.createChunk(fromAt, FONT_META_INFORMATION));
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:34,代码来源:RtfNoteWriter.java

示例3: handleUsersToBeNotified

import com.lowagie.text.Phrase; //导入方法依赖的package包/类
/**
 * Handles the users to be notified of each post.
 *
 * @param list
 *            The post.
 * @param resourcesManager
 *            The used ResourceManager.
 *
 * @param phrase
 *            The phrase to add the information.
 * @param locale
 *            The locale.
 */
private void handleUsersToBeNotified(Collection<DetailedUserData> list, Phrase phrase,
        Locale locale, ResourceBundleManager resourcesManager) {
    if (list == null || list.isEmpty()) {
        return;
    }
    phrase.add(RtfElementFactory.createChunk("\n", FONT_META_INFORMATION));
    phrase.add(RtfElementFactory.createChunk(
            resourcesManager.getText("export.post.title.users", locale) + ":\t",
            FONT_META_INFORMATION));
    String prefix = "";
    for (DetailedUserData user : list) {
        phrase.add(RtfElementFactory.createChunk(
                prefix + user.getFirstName() + " " + user.getLastName() + " ("
                        + user.getAlias() + ")", FONT_META_INFORMATION));
        prefix = ", ";
    }
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:31,代码来源:RtfNoteWriter.java

示例4: writeJndiBinding

import com.lowagie.text.Phrase; //导入方法依赖的package包/类
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 : "");
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:21,代码来源:PdfJndiReport.java

示例5: writeMemoryInformations

import com.lowagie.text.Phrase; //导入方法依赖的package包/类
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"));
		}
	}
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:25,代码来源:PdfJavaInformationsReport.java

示例6: setPhraseStyle

import com.lowagie.text.Phrase; //导入方法依赖的package包/类
/** 
 * 功能说明:为文字填充浅灰色背景</BR> 
 * 修改日期:2011-04-27 
 * @author myclover 
 * @param content   需要填充背景颜色的内容 
 * @param appendStr 不需要填充背景颜色的内容 
 * @return 
 */  
private static Phrase setPhraseStyle(String content , String appendStr){  
    Chunk chunk = new Chunk(content);  
    //填充的背景颜色为浅灰色  
    chunk.setBackground(Color.LIGHT_GRAY);  
    Phrase phrase = new Phrase(chunk);  
    phrase.add(appendStr);  
    return phrase;  
}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:17,代码来源:DocStyleUtils.java

示例7: main

import com.lowagie.text.Phrase; //导入方法依赖的package包/类
/**
 * Changing the style of a FontFactory Font.
 * 
 * @param args
 *            no arguments needed
 */
@Test
public void main() throws Exception {


	// step 1: creation of a document-object
	Document document = new Document();

	// step 2: creation of the writer
	PdfWriter.getInstance(document, PdfTestBase.getOutputStream("fontfactorystyles.pdf"));

	// step 3: we open the document
	document.open();

	String fontPathBase = new File(PdfTestBase.RESOURCES_DIR + "liberation-fonts-ttf").getAbsolutePath();
	// step 4: we add some content
	FontFactory.register(fontPathBase + "/LiberationSans-Regular.ttf");
	FontFactory.register(fontPathBase + "/LiberationSans-Italic.ttf");
	FontFactory.register(fontPathBase + "/LiberationSans-Bold.ttf");
	FontFactory.register(fontPathBase + "/LiberationSans-BoldItalic.ttf");
	
	
	Phrase myPhrase = new Phrase("This is font family Liberation Sans ", FontFactory.getFont("LiberationSans", 8));
	myPhrase.add(new Phrase("italic ", FontFactory.getFont("Arial", 8, Font.ITALIC)));
	myPhrase.add(new Phrase("bold ", FontFactory.getFont("Arial", 8, Font.BOLD)));
	myPhrase.add(new Phrase("bolditalic", FontFactory.getFont("Arial", 8, Font.BOLDITALIC)));
	document.add(myPhrase);

	// step 5: we close the document
	document.close();
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:37,代码来源:FontFactoryStylesTest.java

示例8: createFieldNameAndValuePhrase

import com.lowagie.text.Phrase; //导入方法依赖的package包/类
private Phrase createFieldNameAndValuePhrase(String fn, String fv) {
	Chunk fieldName = new Chunk(fn,boldText);
	Chunk fieldValue = new Chunk(fv,normalText);
	Phrase field = new Phrase();
	field.add(fieldName);
	field.add(fieldValue);
	return field;
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:9,代码来源:IndividualNeedRatingOverTimeReportGenerator.java

示例9: createPhrase

import com.lowagie.text.Phrase; //导入方法依赖的package包/类
/**
 * Returns as simple phrase with all given children added.
 * 
 * @param children
 *            List of children.
 * @return a {@link Phrase}.
 */
public static Element createPhrase(Collection<Object> children) {
    Phrase phrase = new Phrase();
    for (Object child : children) {
        phrase.add(child);
    }
    return phrase;
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:15,代码来源:RtfElementFactory.java

示例10: handleTags

import com.lowagie.text.Phrase; //导入方法依赖的package包/类
/**
 * Checks the Tags
 *
 * @param tags
 *            List containing the tags.
 * @param locale
 *            The locale.
 * @param resourcesManager
 *            The used ResourceManager.
 * @param phrase
 *            The phrase to add the information.
 */
private void handleTags(Collection<TagData> tags, Locale locale,
        ResourceBundleManager resourcesManager, Phrase phrase) {
    if (tags == null || tags.isEmpty()) {
        return;
    }
    ArrayList<String> tagsAsStringArray = new ArrayList<String>();
    for (TagData tag : tags) {
        tagsAsStringArray.add(tag.getName());
    }
    phrase.add(RtfElementFactory.createChunk("\n", FONT_META_INFORMATION));
    phrase.add(RtfElementFactory.createChunk(
            resourcesManager.getText("export.post.title.tags", locale) + ": "
                    + StringUtils.join(tagsAsStringArray, ","), FONT_META_INFORMATION));
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:27,代码来源:RtfNoteWriter.java

示例11: writeServerInfo

import com.lowagie.text.Phrase; //导入方法依赖的package包/类
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);
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:16,代码来源:PdfJavaInformationsReport.java

示例12: writeFileDescriptorCounts

import com.lowagie.text.Phrase; //导入方法依赖的package包/类
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);
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:16,代码来源:PdfJavaInformationsReport.java

示例13: writeTomcatInformations

import com.lowagie.text.Phrase; //导入方法依赖的package包/类
private void writeTomcatInformations(List<TomcatInformations> tomcatInformationsList)
		throws BadElementException, IOException {
	for (final TomcatInformations tomcatInformations : tomcatInformationsList) {
		if (tomcatInformations.getRequestCount() <= 0) {
			continue;
		}
		addCell("Tomcat " + tomcatInformations.getName() + ':');
		// rq: on n'affiche pas pour l'instant getCurrentThreadCount
		final int currentThreadsBusy = tomcatInformations.getCurrentThreadsBusy();
		final String equal = " = ";
		final Phrase phrase = new Phrase(getString("busyThreads") + equal
				+ integerFormat.format(currentThreadsBusy) + DIVIDE
				+ integerFormat.format(tomcatInformations.getMaxThreads()) + BAR_SEPARATOR,
				cellFont);
		final Image threadsImage = Image.getInstance(Bar.toBarWithAlert(
				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
				+ integerFormat.format(tomcatInformations.getBytesSent()) + '\n'
				+ getString("requestCount") + equal
				+ integerFormat.format(tomcatInformations.getRequestCount()) + '\n'
				+ getString("errorCount") + equal
				+ integerFormat.format(tomcatInformations.getErrorCount()) + '\n'
				+ getString("processingTime") + equal
				+ integerFormat.format(tomcatInformations.getProcessingTime()) + '\n'
				+ getString("maxProcessingTime") + equal
				+ integerFormat.format(tomcatInformations.getMaxTime())));
		currentTable.addCell(phrase);
	}
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:35,代码来源:PdfJavaInformationsReport.java

示例14: writeJobTimes

import com.lowagie.text.Phrase; //导入方法依赖的package包/类
private void writeJobTimes(JobInformations jobInformations, CounterRequest counterRequest)
		throws BadElementException, IOException {
	final long elapsedTime = jobInformations.getElapsedTime();
	if (elapsedTime >= 0) {
		final Phrase elapsedTimePhrase = new Phrase(durationFormat.format(elapsedTime),
				cellFont);
		final Image memoryImage = Image
				.getInstance(Bar.toBar(100d * elapsedTime / counterRequest.getMean()), null);
		memoryImage.scalePercent(47);
		elapsedTimePhrase.add("\n");
		elapsedTimePhrase.add(new Chunk(memoryImage, 0, 0));
		addCell(elapsedTimePhrase);
	} else {
		addCell("");
	}
	if (jobInformations.getPreviousFireTime() != null) {
		addCell(fireTimeFormat.format(jobInformations.getPreviousFireTime()));
	} else {
		addCell("");
	}
	if (jobInformations.getNextFireTime() != null) {
		addCell(fireTimeFormat.format(jobInformations.getNextFireTime()));
	} else {
		addCell("");
	}
	// on n'affiche pas la période si >= 1 jour car ce formateur ne saurait pas l'afficher
	if (jobInformations.getRepeatInterval() > 0
			&& jobInformations.getRepeatInterval() < ONE_DAY_MILLIS) {
		addCell(durationFormat.format(new Date(jobInformations.getRepeatInterval())));
	} else if (jobInformations.getCronExpression() != null) {
		addCell(jobInformations.getCronExpression());
	} else {
		addCell("");
	}
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:36,代码来源:PdfJobInformationsReport.java

示例15: addHeaderAndFooter

import com.lowagie.text.Phrase; //导入方法依赖的package包/类
private void addHeaderAndFooter(PdfWriter writer, Document document) {
	if (document.getPageNumber() == 1) {
		return;
	}
       String header = docInstallArgs.getDocName() + " version" + docInstallArgs.getVersion(); 
       PdfContentByte directContent = writer.getDirectContent();
	Phrase headerPhare = ItextUtil.getFontSelector(9, Font.NORMAL, Color.LIGHT_GRAY).process(header);
	headerPhare.add(new LineSeparator(0.5f, 2.5f, Color.LIGHT_GRAY, Element.ALIGN_LEFT, -5f));
	ColumnText.showTextAligned(directContent, Element.ALIGN_LEFT, 
       			headerPhare, document.left(), document.top() + 20, 0);
       
       String footer = Integer.valueOf(document.getPageNumber()).toString();
	ColumnText.showTextAligned(directContent, Element.ALIGN_LEFT, 
			textbFont.process(footer), document.getPageSize().getWidth() / 2.0f - 20, document.bottom() - 20, 0);
}
 
开发者ID:linkeer8802,项目名称:api-resolver,代码行数:16,代码来源:SimplePdfDocInstaller.java


注:本文中的com.lowagie.text.Phrase.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。