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


Java JRDesignTextField.setVerticalAlignment方法代码示例

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


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

示例1: createTextField

import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
private static JRDesignTextField createTextField(ODLTableDefinition table, int columnIndex) {
	JRDesignTextField textField = new JRDesignTextField();
	textField.setVerticalAlignment(VerticalAlignEnum.MIDDLE);

	JRDesignExpression expression = new JRDesignExpression();
	String fld = "$F{" + table.getColumnName(columnIndex) + "}";
	if (table.getColumnType(columnIndex) == ODLColumnType.DOUBLE) {
		String combined = fld + "!=null ? new DecimalFormat(\"###,###.###\").format(" + fld + "):\"\"";
		expression.setText(combined);
	} else {
		expression.setText(fld);
	}
	textField.setExpression(expression);
	textField.setPrintWhenDetailOverflows(false);
	return textField;
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:17,代码来源:ReportBuilderUtils.java

示例2: addParametersToDisplayReportParameters

import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
/**
 * add user friendly paramters to the band and report port parameters if not
 * already present
 *
 * @param designFile
 * @param targetBand
 * @param maxY
 * @return
 * @throws JRException
 */
private int addParametersToDisplayReportParameters(JasperDesign designFile, JRDesignBand targetBand, int maxY)
		throws JRException
{
	for (ReportParameter<?> param : reportProperties.getFilterBuilder().getReportParameters())
	{
		if (param.displayInreport())
		{
			for (String parameterName : param.getParameterNames())
			{
				JRDesignStaticText labelElement = new JRDesignStaticText();

				String strippedLabel = param.getLabel(parameterName).replaceAll("ReportParameter", "");

				labelElement.setText(strippedLabel);
				labelElement.setWidth(125);
				labelElement.setHeight(20);
				labelElement.setBackcolor(new Color(208, 208, 208));
				labelElement.setMode(ModeEnum.OPAQUE);
				labelElement.setVerticalAlignment(VerticalAlignEnum.MIDDLE);

				labelElement.setX(0);
				labelElement.setY(maxY);
				labelElement.setFontName("SansSerif");
				labelElement.setFontSize(12);
				targetBand.addElement(labelElement);

				JRDesignTextField valueElement = new JRDesignTextField();
				valueElement.setExpression(new JRDesignExpression("$P{ParamDisplay-" + parameterName + "}"));
				valueElement.setWidth(400);
				valueElement.setHeight(20);
				valueElement.setBackcolor(new Color(208, 208, 208));
				valueElement.setMode(ModeEnum.OPAQUE);

				valueElement.setX(125);
				valueElement.setY(maxY);
				valueElement.setFontName("SansSerif");
				valueElement.setFontSize(12);
				valueElement.setVerticalAlignment(VerticalAlignEnum.MIDDLE);

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

				if (!designFile.getParametersMap().containsKey("ParamDisplay-" + parameterName))
				{
					JRDesignParameter parameter = new JRDesignParameter();
					parameter.setName("ParamDisplay-" + parameterName);
					parameter.setValueClass(String.class);

					parameter.setForPrompting(false);

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

示例3: cloneTextField

import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
/**
 * Copy all the common attributes from the static text to the new text field element 
 * 
 * @param textObject the new text field element, that will substitute the static text
 * @param labelObject the substituted static text
 */
private void cloneTextField(JRDesignTextField textObject, JRDesignStaticText labelObject)
{
	String staticTextValue = labelObject.getText();
	//If the text is not valid for an expression it will be handled as a string
	if (!isValidExpression(staticTextValue)){
		if (!staticTextValue.startsWith("\"")) staticTextValue = "\"".concat(staticTextValue); //$NON-NLS-1$ //$NON-NLS-2$
		if (!staticTextValue.endsWith("\"")) staticTextValue = staticTextValue.concat("\""); //$NON-NLS-1$ //$NON-NLS-2$
	}
	textObject.setExpression(ExprUtil.setValues(textObject.getExpression(), staticTextValue));
	
	textObject.setHeight(labelObject.getHeight());
	textObject.setWidth(labelObject.getWidth());
	textObject.setX(labelObject.getX());
	textObject.setY(labelObject.getY());
	textObject.setFontName(labelObject.getFontName());
	textObject.setFontSize(labelObject.getFontsize());
	textObject.setBackcolor(labelObject.getBackcolor()); 
	textObject.setForecolor(labelObject.getForecolor());
	
	JRStyle originStyle = labelObject.getStyle();
	textObject.setStyle(originStyle != null ? (JRStyle)originStyle.clone() : null);
	
	textObject.setStyleNameReference(labelObject.getStyleNameReference());
	textObject.setBold(labelObject.isBold());
	textObject.setItalic(labelObject.isItalic());
	textObject.setUnderline(labelObject.isUnderline());
	textObject.setStrikeThrough(labelObject.isStrikeThrough());
	textObject.setHorizontalAlignment(labelObject.getHorizontalAlignmentValue());
	textObject.setVerticalAlignment(labelObject.getVerticalAlignmentValue());
	textObject.setMode(labelObject.getModeValue());
	textObject.setRotation(labelObject.getRotationValue());
	textObject.setStretchType(labelObject.getStretchTypeValue());
	textObject.setKey(labelObject.getKey());
	textObject.setMarkup(labelObject.getMarkup());
	textObject.setPdfEmbedded(labelObject.isPdfEmbedded());
	textObject.setPdfEncoding(labelObject.getPdfEncoding());
	textObject.setPdfFontName(labelObject.getPdfFontName());
	textObject.setPositionType(labelObject.getPositionTypeValue());
	textObject.setPrintInFirstWholeBand(labelObject.isPrintInFirstWholeBand());
	textObject.setPrintRepeatedValues(labelObject.isPrintRepeatedValues());
	textObject.setPrintWhenDetailOverflows(labelObject.isPrintWhenDetailOverflows());
	
	cloneBox(textObject.getLineBox(),labelObject.getLineBox());

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


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