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


Java JRTextElement类代码示例

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


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

示例1: JRBaseTextElement

import net.sf.jasperreports.engine.JRTextElement; //导入依赖的package包/类
/**
 * Initializes properties that are specific to text elements. Common properties are initialized by its
 * parent constructor.
 * @param textElement an element whose properties are copied to this element. Usually it is a
 * {@link net.sf.jasperreports.engine.design.JRDesignTextElement} that must be transformed into an
 * <tt>JRBaseTextElement</tt> at compile time.
 * @param factory a factory used in the compile process
 */
protected JRBaseTextElement(JRTextElement textElement, JRBaseObjectFactory factory)
{
	super(textElement, factory);

	horizontalTextAlign = textElement.getOwnHorizontalTextAlign();
	verticalTextAlign = textElement.getOwnVerticalTextAlign();
	rotationValue = textElement.getOwnRotationValue();
	markup = textElement.getOwnMarkup();

	lineBox = textElement.getLineBox().clone(this);
	paragraph = textElement.getParagraph().clone(this);

	fontName = textElement.getOwnFontName();
	isBold = textElement.isOwnBold();
	isItalic = textElement.isOwnItalic();
	isUnderline = textElement.isOwnUnderline();
	isStrikeThrough = textElement.isOwnStrikeThrough();
	fontsize = textElement.getOwnFontsize();
	pdfFontName = textElement.getOwnPdfFontName();
	pdfEncoding = textElement.getOwnPdfEncoding();
	isPdfEmbedded = textElement.isOwnPdfEmbedded();
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:31,代码来源:JRBaseTextElement.java

示例2: copyTextElement

import net.sf.jasperreports.engine.JRTextElement; //导入依赖的package包/类
/**
 *
 */
protected void copyTextElement(ReportConverter reportConverter, JRTextElement textElement, JRBasePrintText printText)
{
	copyElement(reportConverter, textElement, printText);
	
	printText.copyBox(textElement.getLineBox());
	printText.copyParagraph(textElement.getParagraph());
	
	printText.setBold(textElement.isOwnBold());
	printText.setFontName(textElement.getOwnFontName());
	printText.setFontSize(textElement.getOwnFontsize());
	printText.setHorizontalTextAlign(textElement.getOwnHorizontalTextAlign());
	printText.setItalic(textElement.isOwnItalic());
	printText.setPdfEmbedded(textElement.isOwnPdfEmbedded());
	printText.setPdfEncoding(textElement.getOwnPdfEncoding());
	printText.setPdfFontName(textElement.getOwnPdfFontName());
	printText.setRotation(textElement.getOwnRotationValue());
	printText.setStrikeThrough(textElement.isOwnStrikeThrough());
	printText.setMarkup(textElement.getOwnMarkup());
	printText.setUnderline(textElement.isOwnUnderline());
	printText.setVerticalTextAlign(textElement.getOwnVerticalTextAlign());
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:TextElementConverter.java

示例3: writeTextElement

import net.sf.jasperreports.engine.JRTextElement; //导入依赖的package包/类
/**
 *
 */
private void writeTextElement(JRTextElement textElement) throws IOException
{
	writer.startElement(JRXmlConstants.ELEMENT_textElement);
	writer.addAttribute(JRXmlConstants.ATTRIBUTE_textAlignment, textElement.getOwnHorizontalTextAlign());
	VerticalTextAlignEnum vTextAlign = textElement.getOwnVerticalTextAlign();
	if (isOlderVersionThan(JRConstants.VERSION_6_2_1))
	{
		vTextAlign = vTextAlign == VerticalTextAlignEnum.JUSTIFIED ? VerticalTextAlignEnum.TOP : vTextAlign;
	}
	writer.addAttribute(JRXmlConstants.ATTRIBUTE_verticalAlignment, vTextAlign);
	writer.addAttribute(JRXmlConstants.ATTRIBUTE_rotation, textElement.getOwnRotationValue());
	if (isOlderVersionThan(JRConstants.VERSION_4_0_2))
	{
		writer.addAttribute(JRXmlConstants.ATTRIBUTE_lineSpacing, textElement.getParagraph().getLineSpacing());
	}
	writer.addAttribute(JRXmlConstants.ATTRIBUTE_markup, textElement.getOwnMarkup());

	writeFont(textElement);
	writeParagraph(textElement.getParagraph());

	writer.closeElement(true);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:26,代码来源:JRXmlWriter.java

示例4: findRowGroupColumHeaderElementIndex

import net.sf.jasperreports.engine.JRTextElement; //导入依赖的package包/类
private int findRowGroupColumHeaderElementIndex(int rowGroupIndex, List<JRChild> cellElements)
{
	String rowGropIndexStr = Integer.toString(rowGroupIndex);
	int colHeaderTextIndex = -1;
	for (ListIterator<JRChild> elemIt = cellElements.listIterator(cellElements.size()); elemIt.hasPrevious();)
	{
		JRChild child = elemIt.previous();
		if (child instanceof JRTextElement)
		{
			JRFillTextElement textElement = (JRFillTextElement) child;
			JRElement parentElement = textElement.getParent();
			String prop = parentElement.hasProperties() 
					? parentElement.getPropertiesMap().getProperty(PROPERTY_ROW_GROUP_COLUMN_HEADER) : null;
			if (prop != null && prop.equals(rowGropIndexStr))
			{
				// found it
				colHeaderTextIndex = elemIt.nextIndex();
				break;
			}
		}
	}
	return colHeaderTextIndex;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:24,代码来源:JRFillCrosstab.java

示例5: setTextElement

import net.sf.jasperreports.engine.JRTextElement; //导入依赖的package包/类
/**
 *
 */
protected void setTextElement(JRTextElement textElement)
{
	super.setElement(textElement);
	
	fontName = textElement.getOwnFontName();
	isBold = textElement.isOwnBold();
	isItalic = textElement.isOwnItalic();
	isUnderline = textElement.isOwnUnderline();
	isStrikeThrough = textElement.isOwnStrikeThrough();
	fontsize = textElement.getOwnFontsize();
	pdfFontName = textElement.getOwnPdfFontName();
	pdfEncoding = textElement.getOwnPdfEncoding();
	isPdfEmbedded = textElement.isOwnPdfEmbedded();

	horizontalTextAlign = textElement.getOwnHorizontalTextAlign();
	verticalTextAlign = textElement.getOwnVerticalTextAlign();
	rotationValue = textElement.getOwnRotationValue();
	markup = textElement.getOwnMarkup();
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:JRTemplateText.java

示例6: writeTextElement

import net.sf.jasperreports.engine.JRTextElement; //导入依赖的package包/类
/**
 *
 */
private void writeTextElement( JRTextElement textElement, String textElementName)
{
	if(textElement != null)
	{
		write( textElementName + ".setHorizontalTextAlign({0});\n", textElement.getOwnHorizontalTextAlign());
		write( textElementName + ".setVerticalTextAlign({0});\n", textElement.getOwnVerticalTextAlign());
		write( textElementName + ".setRotation({0});\n", textElement.getOwnRotationValue());
		write( textElementName + ".setMarkup(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(textElement.getOwnMarkup()));
		writeFont( textElement, textElementName);
		writeParagraph( textElement.getParagraph(), textElementName);
		flush();
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:17,代码来源:JRApiWriter.java

示例7: createIconLabelElement

import net.sf.jasperreports.engine.JRTextElement; //导入依赖的package包/类
protected JRDesignComponentElement createIconLabelElement(SortOrderEnum order, JRFillTextElement textElement,
		BuiltinExpressionEvaluatorFactory builtinExpressions)
{
	JRTextElement parentElement = (JRTextElement) textElement.getParent();
	
	JRDesignComponentElement designIconLabelElement = 
		IconLabelComponentUtil.getInstance(filler.getJasperReportsContext()).createIconLabelComponentElement(parentElement, textElement);
	IconLabelComponent iconLabelComponent = (IconLabelComponent)designIconLabelElement.getComponent();

	JRDesignTextField labelTextField = (JRDesignTextField)iconLabelComponent.getLabelTextField();
	JRDesignTextField iconTextField = (JRDesignTextField)iconLabelComponent.getIconTextField();

	designIconLabelElement.setStyle(textElement.getInitStyle());
	labelTextField.setStyle(textElement.getInitStyle());
	iconTextField.setStyle(textElement.getInitStyle());

	if (textElement instanceof JRTextField) 
	{
		labelTextField.setExpression(((JRTextField) textElement).getExpression());
	}
	else if (textElement instanceof JRStaticText) 
	{
		String text = ((JRStaticText) textElement).getText();
		labelTextField.setExpression(builtinExpressions.createConstantExpression(text));
	}
	
	String iconText =
			order == SortOrderEnum.ASCENDING ? filler.getPropertiesUtil().getProperty(TableReport.PROPERTY_UP_ARROW_CHAR)
			: (order == SortOrderEnum.DESCENDING ? filler.getPropertiesUtil().getProperty(TableReport.PROPERTY_DOWN_ARROW_CHAR) : "");
	iconTextField.setExpression(builtinExpressions.createConstantExpression(" " + iconText)); 
	
	designIconLabelElement.getPropertiesMap().setProperty(
			MatcherExporterFilter.PROPERTY_MATCHER_EXPORT_FILTER_KEY, 
			TableReport.TABLE_HEADER_ICON_LABEL_MATCHER_EXPORT_KEY
			);
	
	return designIconLabelElement;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:39,代码来源:JRFillCrosstab.java

示例8: JRFillTextElement

import net.sf.jasperreports.engine.JRTextElement; //导入依赖的package包/类
/**
 *
 */
protected JRFillTextElement(
	JRBaseFiller filler,
	JRTextElement textElement, 
	JRFillObjectFactory factory
	)
{
	super(filler, textElement, factory);

	initLineBox = textElement.getLineBox().clone(this);
	initParagraph = textElement.getParagraph().clone(this);

	// not supporting property expressions for this
	this.consumeSpaceOnOverflow = filler.getPropertiesUtil().getBooleanProperty(
			PROPERTY_CONSUME_SPACE_ON_OVERFLOW, true,
			// manually falling back to report properties as getParentProperties() is null for textElement
			textElement, filler.getMainDataset()
			);
	
	this.defaultKeepFullText = filler.getPropertiesUtil().getBooleanProperty( 
			JRTextElement.PROPERTY_PRINT_KEEP_FULL_TEXT, false,
			// manually falling back to report properties as getParentProperties() is null for textElement
			textElement, filler.getMainDataset());
	this.dynamicKeepFullText = hasDynamicProperty(JRTextElement.PROPERTY_PRINT_KEEP_FULL_TEXT);
	
	this.fillStyleObjectsMap = new HashMap<JRStyle, JRFillTextElement.FillStyleObjects>();
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:30,代码来源:JRFillTextElement.java

示例9: TextMeasurer

import net.sf.jasperreports.engine.JRTextElement; //导入依赖的package包/类
/**
 * 
 */
public TextMeasurer(JasperReportsContext jasperReportsContext, JRCommonText textElement)
{
	this.jasperReportsContext = jasperReportsContext;
	this.textElement = textElement;
	this.propertiesHolder = textElement instanceof JRPropertiesHolder ? (JRPropertiesHolder) textElement : null;//FIXMENOW all elements are now properties holders, so interfaces might be rearranged
	if (textElement.getDefaultStyleProvider() instanceof JRPropertiesHolder)
	{
		this.propertiesHolder = 
			new DelegatePropertiesHolder(
				propertiesHolder, 
				(JRPropertiesHolder)textElement.getDefaultStyleProvider()
				);
	}
	
	if (textElement instanceof DynamicPropertiesHolder)
	{
		this.dynamicPropertiesHolder = (DynamicPropertiesHolder) textElement;
		
		// we can check this from the beginning
		this.hasDynamicIgnoreMissingFontProp = this.dynamicPropertiesHolder.hasDynamicProperty(
				JRStyledText.PROPERTY_AWT_IGNORE_MISSING_FONT);
		this.hasDynamicSaveLineBreakOffsetsProp = this.dynamicPropertiesHolder.hasDynamicProperty(
				JRTextElement.PROPERTY_SAVE_LINE_BREAKS);
	}

	// read static property values
	JRPropertiesUtil propertiesUtil = JRPropertiesUtil.getInstance(jasperReportsContext);
	defaultIgnoreMissingFont = propertiesUtil.getBooleanProperty(propertiesHolder, 
			JRStyledText.PROPERTY_AWT_IGNORE_MISSING_FONT, false);
	defaultSaveLineBreakOffsets = propertiesUtil.getBooleanProperty(propertiesHolder, 
			JRTextElement.PROPERTY_SAVE_LINE_BREAKS, false);
	
	Context measureContext = new Context();
	simpleLineWrapper = new SimpleTextLineWrapper();
	simpleLineWrapper.init(measureContext);
	
	complextLineWrapper = new ComplexTextLineWrapper();
	complextLineWrapper.init(measureContext);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:43,代码来源:TextMeasurer.java

示例10: getTruncateSuffix

import net.sf.jasperreports.engine.JRTextElement; //导入依赖的package包/类
protected String getTruncateSuffix()
{
	//FIXME do not read each time
	String truncateSuffx = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(propertiesHolder,
			JRTextElement.PROPERTY_TRUNCATE_SUFFIX);
	if (truncateSuffx != null)
	{
		truncateSuffx = truncateSuffx.trim();
		if (truncateSuffx.length() == 0)
		{
			truncateSuffx = null;
		}
	}
	return truncateSuffx;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:16,代码来源:TextMeasurer.java

示例11: getFontClone

import net.sf.jasperreports.engine.JRTextElement; //导入依赖的package包/类
protected JRFont getFontClone(JRFont sourceFont){
	if (sourceFont == null) return null;
	if (sourceFont instanceof JRBaseFont){
		return (JRBaseFont)((JRBaseFont)sourceFont).clone();
	}
	if (sourceFont instanceof JRTextElement){
		return (JRTextElement)((JRTextElement)sourceFont).clone();
	}
	return null;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:11,代码来源:MGraphicElement.java

示例12: decorateWithSortIcon

import net.sf.jasperreports.engine.JRTextElement; //导入依赖的package包/类
private JRFillCellContents decorateWithSortIcon(JRFillCellContents cell, SortOrderEnum order)
{
	// check whether the contents contain a single text element
	JRElement[] elements = cell.getElements();
	if (elements.length != 1)
	{
		if (log.isDebugEnabled())
		{
			log.debug("order by column header has " + elements.length + " elements");
		}
		
		return cell;
	}
	
	if (!(elements[0] instanceof JRTextElement))
	{
		if (log.isDebugEnabled())
		{
			log.debug("order by column header has element " + elements[0].getClass().getName());
		}
		
		return cell;
	}
	
	// TODO lucianc cache
	JRFillTextElement textElement = (JRFillTextElement) elements[0];
	if (log.isDebugEnabled())
	{
		log.debug("wrapping column header element " + textElement.getUUID() + " in iconLabel");
	}
	
	BuiltinExpressionEvaluatorFactory builtinExpressions = new BuiltinExpressionEvaluatorFactory();
	JRDesignComponentElement iconLabelElement = createIconLabelElement(order, textElement, builtinExpressions);

	JRFillExpressionEvaluator decoratedEvaluator = builtinExpressions.decorate(cell.expressionEvaluator);
	IconLabelFillObjectFactory factory = new IconLabelFillObjectFactory(fillFactory, decoratedEvaluator);
	JRFillComponentElement fillIconLabelElement = new JRFillComponentElement(filler, iconLabelElement, factory);
	
	JRFillCellContents clonedCell = (JRFillCellContents) cell.createClone();
	clonedCell.addElement(1, fillIconLabelElement);
	
	JRFillElement clonedTextElement = (JRFillElement) clonedCell.getElements()[0];
	clonedTextElement.setExpressionEvaluator(decoratedEvaluator);
	clonedTextElement.addDynamicProperty(MatcherExporterFilter.PROPERTY_MATCHER_EXPORT_FILTER_KEY, 
			builtinExpressions.createConstantExpression(TableReport.TABLE_HEADER_LABEL_MATCHER_EXPORT_KEY));
	
	return clonedCell;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:49,代码来源:JRFillCrosstab.java

示例13: getOwnHorizontalTextAlign

import net.sf.jasperreports.engine.JRTextElement; //导入依赖的package包/类
@Override
public HorizontalTextAlignEnum getOwnHorizontalTextAlign()
{
	return providerStyle == null || providerStyle.getOwnHorizontalTextAlign() == null ? ((JRTextElement)this.parent).getOwnHorizontalTextAlign() : providerStyle.getOwnHorizontalTextAlign();
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:6,代码来源:JRFillTextElement.java

示例14: getOwnVerticalTextAlign

import net.sf.jasperreports.engine.JRTextElement; //导入依赖的package包/类
@Override
public VerticalTextAlignEnum getOwnVerticalTextAlign()
{
	return providerStyle == null || providerStyle.getOwnVerticalTextAlign() == null ? ((JRTextElement)this.parent).getOwnVerticalTextAlign() : providerStyle.getOwnVerticalTextAlign();
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:6,代码来源:JRFillTextElement.java

示例15: getOwnRotationValue

import net.sf.jasperreports.engine.JRTextElement; //导入依赖的package包/类
@Override
public RotationEnum getOwnRotationValue()
{
	return providerStyle == null || providerStyle.getOwnRotationValue() == null ? ((JRTextElement)this.parent).getOwnRotationValue() : providerStyle.getOwnRotationValue();
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:6,代码来源:JRFillTextElement.java


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