本文整理汇总了Java中net.sf.jasperreports.engine.design.JRDesignStaticText.setY方法的典型用法代码示例。如果您正苦于以下问题:Java JRDesignStaticText.setY方法的具体用法?Java JRDesignStaticText.setY怎么用?Java JRDesignStaticText.setY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jasperreports.engine.design.JRDesignStaticText
的用法示例。
在下文中一共展示了JRDesignStaticText.setY方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例3: addColumnHeaderToBand
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入方法依赖的package包/类
private static void addColumnHeaderToBand(ODLTableDefinition table, int elementWidth, JRDesignBand chBand) {
JRDesignStaticText back = new JRDesignStaticText();
back.setBackcolor(new Color(230, 230, 230));
back.setWidth(elementWidth);
back.setHeight(20);
back.setMode(ModeEnum.OPAQUE);
chBand.addElement(back);
List<Double> colWidths = getColumnWidths(table, elementWidth);
int nc = table.getColumnCount();
if (nc > 0) {
double dx=0;
for (int i = 0; i < nc; i++) {
JRDesignStaticText text = new JRDesignStaticText();
int x = (int) Math.round(dx);
text.setX(x);
text.setY(4);
text.setWidth((int) Math.floor(colWidths.get(i)));
text.setHeight(15);
text.setText(table.getColumnName(i));
text.setFontSize(11);
// int fs = text.getFontSize();
text.setForecolor(new Color(0, 0, 80));
text.setBold(true);
chBand.addElement(text);
dx += colWidths.get(i);
}
}
JRDesignLine line = new JRDesignLine();
// line.setX(-ret.getLeftMargin());
line.setY(19);
line.setWidth(elementWidth);
line.setHeight(0);
line.setPositionType(PositionTypeEnum.FLOAT);
chBand.addElement(line);
}
示例4: addParametersToDisplayReportParameters
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入方法依赖的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;
}
示例5: 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());
}
示例6: 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;
}