本文整理汇总了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;
}
示例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;
}
示例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());
}