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


Java JRDesignStaticText.setHorizontalAlignment方法代码示例

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


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

示例1: createLabel

import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入方法依赖的package包/类
private JRDesignStaticText createLabel(JasperDesign jd, String text, int w, int h, String styleName)
{
    JRDesignStaticText element = new JRDesignStaticText();
    element.setX(0);
    element.setY(0);
    element.setWidth(w);
    element.setHeight(h);
    element.setText(text);
    element.setHorizontalAlignment( HorizontalAlignEnum.CENTER );
    element.setVerticalAlignment( VerticalAlignEnum.MIDDLE);
    
    if (styleName != null && jd.getStylesMap().containsKey(styleName))
    {
        element.setStyle( (JRStyle) jd.getStylesMap().get(styleName) );
    }
    return element;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:18,代码来源:NewTypesUtils.java

示例2: createLabel

import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入方法依赖的package包/类
private JRDesignStaticText createLabel(String text, int w, int h)
{
    JRDesignStaticText element = new JRDesignStaticText();
    element.setX(0);
    element.setY(0);
    element.setWidth(w);
    element.setHeight(h);
    element.setText(text);
    element.setHorizontalAlignment( HorizontalAlignEnum.CENTER );
    element.setVerticalAlignment( VerticalAlignEnum.MIDDLE);
    return element;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:13,代码来源:CreateCrosstabAction.java

示例3: cloneTextField

import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入方法依赖的package包/类
/**
 * Copy all the common attributes from the text field to the new static text element 
 * 
 * @param labelObject the new static text element, that will substitute the text field
 * @param textObject the substituted text field
 */
private void cloneTextField(JRDesignStaticText labelObject, JRDesignTextField textObject)
{
	labelObject.setText(textObject.getExpression().getText());
	labelObject.setHeight(textObject.getHeight());
	labelObject.setWidth(textObject.getWidth());
	labelObject.setX(textObject.getX());
	labelObject.setY(textObject.getY());
	labelObject.setFontName(textObject.getFontName());
	labelObject.setFontSize(textObject.getFontsize());
	labelObject.setBackcolor(textObject.getBackcolor()); 
	labelObject.setForecolor(textObject.getForecolor());
	
	JRStyle originStyle = textObject.getStyle();
	labelObject.setStyle(originStyle != null ? (JRStyle)originStyle.clone() : null);
	
	labelObject.setStyleNameReference(textObject.getStyleNameReference());
	labelObject.setBold(textObject.isBold());
	labelObject.setItalic(textObject.isItalic());
	labelObject.setUnderline(textObject.isUnderline());
	labelObject.setStrikeThrough(textObject.isStrikeThrough());
	labelObject.setHorizontalAlignment(textObject.getHorizontalAlignmentValue());
	labelObject.setVerticalAlignment(textObject.getVerticalAlignmentValue());
	labelObject.setMode(textObject.getModeValue());
	labelObject.setRotation(textObject.getRotationValue());
	labelObject.setStretchType(textObject.getStretchTypeValue());
	labelObject.setKey(textObject.getKey());
	labelObject.setMarkup(textObject.getMarkup());
	labelObject.setPdfEmbedded(textObject.isPdfEmbedded());
	labelObject.setPdfEncoding(textObject.getPdfEncoding());
	labelObject.setPdfFontName(textObject.getPdfFontName());
	labelObject.setPositionType(textObject.getPositionTypeValue());
	labelObject.setPrintInFirstWholeBand(textObject.isPrintInFirstWholeBand());
	labelObject.setPrintRepeatedValues(textObject.isPrintRepeatedValues());
	labelObject.setPrintWhenDetailOverflows(textObject.isPrintWhenDetailOverflows());
	
	cloneBox(labelObject.getLineBox(), textObject.getLineBox());

	cloneParagraph(labelObject.getParagraph(), textObject.getParagraph());
	
	JRExpression originExpression = textObject.getPrintWhenExpression();
	labelObject.setPrintWhenExpression(originExpression != null ? (JRExpression)originExpression.clone() : null);
	
	JRGroup originGroup = textObject.getPrintWhenGroupChanges();
	labelObject.setPrintWhenGroupChanges(originGroup != null ? (JRGroup)originGroup.clone() : null);
	
	labelObject.setRemoveLineWhenBlank(textObject.isRemoveLineWhenBlank());
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:54,代码来源:ConvertTextIntoStatic.java

示例4: determineSizeOfTemplateBandAndReplaceTitlePlaceHolder

import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入方法依赖的package包/类
/**
 * replace the place holder in the targetBand with the report title, also
 * add a set of dynamically generated user friendly report parameter fields
 * to this band and add parameters to the report for them if not already
 * present.
 *
 * @param designFile
 * @param templateBand
 * @param targetBand
 * @param margin
 * @return
 * @throws JRException
 */
private int determineSizeOfTemplateBandAndReplaceTitlePlaceHolder(JasperDesign designFile, JRBand templateBand,
		JRDesignBand targetBand, int margin) throws JRException
{
	int maxY = 0;
	for (JRElement element : templateBand.getElements())
	{

		JRDesignElement de = (JRDesignElement) element;
		if (element instanceof JRStaticText)
		{
			JRStaticText st = (JRStaticText) element;
			if (st.getText().equalsIgnoreCase("report name place holder"))
			{
				st.setText(reportProperties.getReportTitle());
				st.setWidth((designFile.getPageWidth() - st.getX()) - (margin * 2));
			}
		}

		if (element instanceof JRDesignImage)
		{
			JRDesignImage im = (JRDesignImage) element;
			String expr = im.getExpression().getText();
			if (expr.contains("logo.png"))
			{
				int height = 140;
				final int imageWidth = designFile.getPageWidth() - (margin * 2);
				String fileName = reportProperties.generateDynamicHeaderImage(imageWidth, height,
						reportProperties.getReportTitle());
				im.setWidth(imageWidth);
				// im.setHeight(height);
				im.setX(-8);

				expr = expr.replace("logo.png", fileName);
				im.setExpression(new JRDesignExpression(expr));
			}
		}

		maxY = Math.max(maxY, de.getY() + de.getHeight());

		targetBand.addElement(de);

	}

	JRDesignStaticText paramElement = new JRDesignStaticText();
	paramElement.setText("Parameters");
	paramElement.setWidth(525);
	paramElement.setHeight(15);
	paramElement.setBackcolor(new Color(95, 96, 98));
	paramElement.setForecolor(new Color(255, 255, 255));
	paramElement.setMode(ModeEnum.OPAQUE);

	paramElement.setX(0);
	paramElement.setY(maxY + 2);
	paramElement.setFontName("Arial");
	paramElement.setBold(true);
	paramElement.setFontSize(12);
	paramElement.setHorizontalAlignment(HorizontalAlignEnum.CENTER);
	paramElement.setVerticalAlignment(VerticalAlignEnum.MIDDLE);

	targetBand.addElement(paramElement);
	maxY = paramElement.getY() + paramElement.getHeight();

	maxY = addParametersToDisplayReportParameters(designFile, targetBand, maxY);
	return maxY;
}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:79,代码来源:JasperManager.java


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