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


Java JRStyledText类代码示例

本文整理汇总了Java中net.sf.jasperreports.engine.util.JRStyledText的典型用法代码示例。如果您正苦于以下问题:Java JRStyledText类的具体用法?Java JRStyledText怎么用?Java JRStyledText使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getFullStyledText

import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
@Override
public JRStyledText getFullStyledText(JRStyledTextAttributeSelector attributeSelector)
{
	if (getFullText() == null)
	{
		return null;
	}

	return 
		JRStyledTextParser.getInstance().getStyledText(
			attributeSelector.getStyledTextAttributes(this), 
			getFullText(), 
			!JRCommonText.MARKUP_NONE.equals(getMarkup()),
			JRStyledTextAttributeSelector.getTextLocale(this)
			);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:17,代码来源:JRBasePrintText.java

示例2: getRichTextString

import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
protected HSSFRichTextString getRichTextString(JRStyledText styledText, short forecolor, JRFont defaultFont, Locale locale)
{
	String text = styledText.getText();
	HSSFRichTextString richTextStr = new HSSFRichTextString(text);
	int runLimit = 0;
	AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator();

	while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length())
	{
		Map<Attribute,Object> attributes = iterator.getAttributes();
		JRFont runFont = attributes.isEmpty()? defaultFont : new JRBaseFont(attributes);
		short runForecolor = attributes.get(TextAttribute.FOREGROUND) != null ? 
				getWorkbookColor((Color)attributes.get(TextAttribute.FOREGROUND)).getIndex() :
				forecolor;
		HSSFFont font = getLoadedFont(runFont, runForecolor, attributes, locale);
		richTextStr.applyFont(iterator.getIndex(), runLimit, font);
		iterator.setIndex(runLimit);
	}
	return richTextStr;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:21,代码来源:JRXlsExporter.java

示例3: exportStyledText

import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
/**
 *
 */
protected void exportStyledText(JRStyledText styledText, Locale locale, boolean startedHyperlink, boolean isIgnoreTextFormatting)
{
	String text = styledText.getText();

	int runLimit = 0;

	AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator();

	while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length())
	{
		exportStyledTextRun(
			iterator.getAttributes(), 
			text.substring(iterator.getIndex(), runLimit),
			locale,
			startedHyperlink,
			isIgnoreTextFormatting
			);

		iterator.setIndex(runLimit);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:TableBuilder.java

示例4: getTextRenderer

import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
protected AbstractPdfTextRenderer getTextRenderer(JRPrintText text, JRStyledText styledText)
{
	AbstractPdfTextRenderer textRenderer;
	if (toUseGlyphRenderer(text)
			&& PdfGlyphRenderer.supported()
			&& canUseGlyphRendering(text, styledText))
	{
		textRenderer = new PdfGlyphRenderer(jasperReportsContext, awtIgnoreMissingFont,
				glyphRendererAddActualText && !tagHelper.isTagged);
	}
	else if (text.getLeadingOffset() == 0)
	{
		textRenderer = new PdfTextRenderer(jasperReportsContext, awtIgnoreMissingFont);
	}
	else
	{
		textRenderer = new SimplePdfTextRenderer(jasperReportsContext, awtIgnoreMissingFont);//FIXMETAB optimize this
	}
	
	return textRenderer;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:22,代码来源:JRPdfExporter.java

示例5: getRichTextString

import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
protected HSSFRichTextString getRichTextString(JRStyledText styledText, short forecolor, JRFont defaultFont, Locale locale) {
	String text = styledText.getText();
	HSSFRichTextString richTextStr = new HSSFRichTextString(text);
	int runLimit = 0;
	AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator();

	while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length()) {
		Map<Attribute,Object> attributes = iterator.getAttributes();
		JRFont runFont = attributes.isEmpty()? defaultFont : new JRBaseFont(attributes);
		short runForecolor = attributes.get(TextAttribute.FOREGROUND) != null  
			? getWorkbookColor((Color)attributes.get(TextAttribute.FOREGROUND)).getIndex() 
			: forecolor;
		HSSFFont font = getLoadedFont(runFont, runForecolor, attributes, locale);
		richTextStr.applyFont(iterator.getIndex(), runLimit, font);
		iterator.setIndex(runLimit);
	}
	return richTextStr;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:19,代码来源:JRXlsMetadataExporter.java

示例6: getStyledText

import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
@Override
protected JRStyledText getStyledText(JRPrintText textElement, boolean setBackcolor)
{
	JRStyledText styledText = styledTextUtil.getProcessedStyledText(textElement, 
			setBackcolor ? allSelector : noBackcolorSelector, getExporterKey());
	
	if (styledText != null)
	{
		short[] lineBreakOffsets = textElement.getLineBreakOffsets();
		if (lineBreakOffsets != null && lineBreakOffsets.length > 0)
		{
			//insert new lines at the line break positions saved at fill time
			//cloning the text first
			//FIXME do we need this?  styled text instances are no longer shared
			styledText = styledText.cloneText();
			styledText.insert("\n", lineBreakOffsets);
		}
	}
	
	return styledText;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:22,代码来源:AbstractHtmlExporter.java

示例7: DrawVisitor

import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
/**
 *
 */
public DrawVisitor(ReportConverter reportConverter, Graphics2D grx)
{
	this.convertVisitor = new ConvertVisitor(reportConverter);
	
	JasperReportsContext jasperReportsContext = reportConverter.getJasperReportsContext();
	JRReport report = reportConverter.getReport();
	JRPropertiesUtil propUtil = JRPropertiesUtil.getInstance(jasperReportsContext);
	
	this.drawVisitor = 
		new PrintDrawVisitor(
			jasperReportsContext,
			new RenderersCache(jasperReportsContext),
			propUtil.getBooleanProperty(report, Graphics2DReportConfiguration.MINIMIZE_PRINTER_JOB_SIZE, true),
			propUtil.getBooleanProperty(report, JRStyledText.PROPERTY_AWT_IGNORE_MISSING_FONT, false)
			);
	
	setGraphics2D(grx);
	this.drawVisitor.setClip(true);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:DrawVisitor.java

示例8: exportStyledText

import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
/**
 *
 */
protected void exportStyledText(JRStyle style, JRStyledText styledText, Locale locale)
{
	String text = styledText.getText();

	int runLimit = 0;

	AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator();

	while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length())
	{
		runHelper.export(
			style, 
			iterator.getAttributes(), 
			text.substring(iterator.getIndex(), runLimit),
			locale,
			invalidCharReplacement
			);

		iterator.setIndex(runLimit);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:JRPptxExporter.java

示例9: exportStyledText

import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
/**
 *
 */
protected void exportStyledText(JRStyle style, JRStyledText styledText, Locale locale, boolean isStyledText)
{
	String text = styledText.getText();
	
	int runLimit = 0;
	
	AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator();
	
	while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length())
	{
		runHelper.export(
				style, iterator.getAttributes(), 
				text.substring(iterator.getIndex(), runLimit),
				locale,
				invalidCharReplacement,
				isStyledText
				);
		
		iterator.setIndex(runLimit);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:JRXlsxExporter.java

示例10: getStyledText

import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
/**
 *
 */
protected JRStyledText getStyledText()
{
	if (styledText == null)
	{
		String text = getRawText();
		if (text != null)
		{
			styledText = 
				filler.getStyledTextParser().getStyledText(
					getStyledTextAttributes(), 
					text, 
					!JRCommonText.MARKUP_NONE.equals(getMarkup()),
					filler.getLocale()
					);
		}
		processedStyledText = null;
	}
	
	return styledText;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:24,代码来源:JRFillTextElement.java

示例11: addContentField

import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
protected void addContentField(int pageNo, JRPrintText element) throws IOException {
	String allText;
	JRStyledText styledText = getStyledText(element);
	if (styledText == null) {
		allText = "";
	} else {
		allText = styledText.getText();
	}

	if (allText != null && allText.length() > 0) {
		Field tf = new Field(CONTENT_FIELD, allText, fieldType);
		Document doc = new Document();
		doc.add(new IntField("pageNo", pageNo, Field.Store.YES));

		PrintElementId peid = PrintElementId.forElement(element);
		doc.add(new StringField("uid", peid.toString(), Field.Store.YES));

		displayTokens(allText, peid.toString());

		doc.add(tf);
		writer.addDocument(doc);
	}

}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:LuceneUtil.java

示例12: getTextValue

import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
@Override
public String getTextValue(JRCsvExporterContext exporterContext, JRGenericPrintElement element)
{
	JRPrintText labelPrintText = (JRPrintText)element.getParameterValue(IconLabelElement.PARAMETER_LABEL_TEXT_ELEMENT);
	if (labelPrintText == null)
	{
		return null;
	}
	
	String text = null;
	
	JRStyledText styledText = ((JRCsvExporter)exporterContext.getExporterRef()).getStyledText(labelPrintText);
	if (styledText == null)
	{
		text = "";
	}
	else
	{
		text = styledText.getText();
	}
	
	return text;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:24,代码来源:IconLabelElementCsvHandler.java

示例13: JSSDrawVisitor

import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
/**
 *
 */
public JSSDrawVisitor(ReportConverter reportConverter, Graphics2D grx) {
	this.reportConverter = reportConverter;
	this.convertVisitor = new JSSConvertVisitor(reportConverter);
	final JasperReportsContext jasperReportsContext = reportConverter.getJasperReportsContext();
	this.drawVisitor = new PrintDrawVisitor(jasperReportsContext) {
		@Override
		public void setTextRenderer(JRReport report) {
			AwtTextRenderer textRenderer = new AwtTextRenderer(jasperReportsContext, JRPropertiesUtil.getInstance(
					jasperReportsContext).getBooleanProperty(report, JRGraphics2DExporter.MINIMIZE_PRINTER_JOB_SIZE, true),
					JRPropertiesUtil.getInstance(jasperReportsContext).getBooleanProperty(report,
							JRStyledText.PROPERTY_AWT_IGNORE_MISSING_FONT, false));

			setTextDrawer(new TextDrawer(jasperReportsContext, textRenderer));
			setFrameDrawer(new FrameDrawer(jasperReportsContext, null, textRenderer));
			
		}

	};
	setTextRenderer(reportConverter.getReport());
	this.grx = grx;
	setGraphics2D(grx);
	this.drawVisitor.setClip(true);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:27,代码来源:JSSDrawVisitor.java

示例14: getPhrase

import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
/**
 *
 */
protected Phrase getPhrase(JRStyledText styledText, JRPrintText textElement)
{
	String text = styledText.getText();

	AttributedString as = styledText.getAttributedString();

	return pdfExporter.getPhrase(as, text, textElement);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:12,代码来源:SimplePdfTextRenderer.java

示例15: setRichTextStringCellValue

import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
protected final void setRichTextStringCellValue(JRStyledText styledText, short forecolor, JRFont defaultFont, Locale locale)
{	
	if(styledText != null)
	{
		cell.setCellValue(getRichTextString(styledText, forecolor, defaultFont, locale));
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:8,代码来源:JRXlsExporter.java


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