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


Java JRDesignBand.addElement方法代码示例

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


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

示例1: addFieldHeader

import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
private void addFieldHeader(GridColumnVO columnVO) {
  JRDesignBand bHeader = (JRDesignBand) jasperDesign.getColumnHeader();
  JRDesignStaticText text = new JRDesignStaticText();
  text.setText(columnVO.getTitle());
  text.setWidth(columnVO.getWidth());
  text.setHeight(bHeader.getHeight());
  text.setX(px);
  // Set syle
  text.setFontName(gridReportVO.getHeaderBandStyle().getFontName());
  text.setFontSize(new Float(gridReportVO.getHeaderBandStyle().getFontSize()));
  text.setForecolor(gridReportVO.getHeaderBandStyle().getForeColor());
  text.setBold(gridReportVO.getHeaderBandStyle().isBold());
  text.setItalic(gridReportVO.getHeaderBandStyle().isItalic());
  text.setUnderline(gridReportVO.getHeaderBandStyle().isUnderline());
  if (log4j.isDebugEnabled())
    log4j.debug("Field Header, field: " + columnVO.getTitle() + " Width: " + columnVO.getWidth()
        + " X: " + px);
  bHeader.addElement(text);
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:20,代码来源:ReportDesignBO.java

示例2: createDesign

import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
/**
 * Create a very minimal jasperdesign where the static text is placed. It is cached
 * since we don't need to create it everytime
 */
private static void createDesign()
 {
      jasperDesign = new JasperDesign();
      JRDesignBand jrBand = new JRDesignBand();
  		 jasperDesign.setTitle(jrBand);
      textElement = new JRDesignStaticText();
      jasperDesign.setLeftMargin(0);
      jasperDesign.setRightMargin(0);
      jasperDesign.setTopMargin(0);
      jasperDesign.setBottomMargin(0);
      jrBand.addElement(textElement);
      jrBand.setSplitType(SplitTypeEnum.STRETCH);
      textElement.setStretchType(StretchTypeEnum.NO_STRETCH);
      textElement.setPrintRepeatedValues(false);
      textElement.setPrintWhenDetailOverflows(true);
  }
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:21,代码来源:PreviewGenerator.java

示例3: createDetail

import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
/**
 * Create a detail section in a {@link JasperReport}. Checks the {@link JasperReport} fields for a
 * {@link Detail} annotation and processes that {@link Detail} field.
 */
public JRBand createDetail(final Field subReport) throws Exception {
    final JRDesignBand retval = new JRDesignBand();

    retval.setHeight(SUBREPORT_HEIGHT - 25);

    LOG.debug("Subreport Detail band has height of "+ retval.getHeight());

    // In this case, we are creating a subreport and subreports have either a crosstab or not
    LOG.debug("Checking if "+ subReport+ " is a crosstab "+ isCrosstab(subReport));
    if (isCrosstab(subReport)) {
        final JRDesignCrosstab crosstab = createCrosstab();
        LOG.debug("Got crosstab of height "+ crosstab.getHeight()+
              " and width "+ crosstab.getWidth()+
              " adding to design of height "+ retval.getHeight());

        retval.addElement(crosstab);
    }

    return retval;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:25,代码来源:TravelReportFactoryServiceImpl.java

示例4: createSummary

import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
/**
 * Create a summary section in a {@link JasperReport}. Checks the {@link JasperReport} fields for a
 * {@link Summary} annotation and processes that {@link Summary} field.
 *
 * @return subreport is the {@link SubReport} {@link Field}
 * @return {@link JRBand} of the summary that goes into a subreport
 */
public JRBand createSummary(final Field subReport) throws Exception {
    final JRDesignBand retval = new JRDesignBand();

    retval.setHeight(SUBREPORT_HEIGHT);

    LOG.debug("Summary band has height of "+ retval.getHeight());

    // In this case, we are creating a subreport and subreports have either a crosstab or not
    LOG.debug("Checking if "+ subReport+ " is a crosstab "+ isCrosstab(subReport));
    if (isCrosstab(subReport)) {
        final JRDesignCrosstab crosstab = createCrosstab();
        LOG.debug("Got crosstab of height "+ crosstab.getHeight()+ " and width "+ crosstab.getWidth()+ " adding to design of height "+ retval.getHeight());

        retval.addElement(crosstab);
    }

    return retval;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:26,代码来源:TravelReportFactoryServiceImpl.java

示例5: addFieldValue

import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
private void addFieldValue(GridColumnVO columnVO) throws JRException {
  JRDesignBand bDetalle = (JRDesignBand) jasperDesign.getDetailSection().getBands()[0];

  JRDesignField f = new JRDesignField();
  f.setName(columnVO.getDbName());
  f.setValueClass(columnVO.getFieldClass());
  jasperDesign.addField(f);

  JRDesignExpressionChunk chunk = new JRDesignExpressionChunk();
  chunk.setText(columnVO.getDbName());
  chunk.setType(JRDesignExpressionChunk.TYPE_FIELD);
  JRDesignExpression expression = new JRDesignExpression();
  expression.addChunk(chunk);
  JRDesignTextField textField = new JRDesignTextField();
  textField.setWidth(columnVO.getWidth());
  textField.setHeight(bDetalle.getHeight());
  textField.setX(px);
  textField.setExpression(expression);
  textField.setBlankWhenNull(true);
  textField.setFontName(gridReportVO.getDetailBandStyle().getFontName());
  textField.setFontSize(new Float(gridReportVO.getDetailBandStyle().getFontSize()));
  textField.setForecolor(gridReportVO.getDetailBandStyle().getForeColor());
  textField.setBold(gridReportVO.getDetailBandStyle().isBold());
  textField.setItalic(gridReportVO.getDetailBandStyle().isItalic());
  textField.setUnderline(gridReportVO.getDetailBandStyle().isUnderline());
  textField.setStretchWithOverflow(true);
  textField.setStretchType(StretchTypeEnum.RELATIVE_TO_TALLEST_OBJECT);

  bDetalle.addElement(textField);
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:31,代码来源:ReportDesignBO.java

示例6: buildPageFooterBand

import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
/**
 * Build the page footer band
 * 
 * @return
 */
private static JRDesignBand buildPageFooterBand() {
	JRDesignBand band = new JRDesignBand();
	band.setHeight(20);
	JRDesignTextField rightText = new JRDesignTextField();
	rightText.setY(0);
	rightText.setWidth(300);
	rightText.setHeight(15);
	rightText.setHorizontalTextAlign(HorizontalTextAlignEnum.LEFT);
	JRDesignExpression rightExpression = new JRDesignExpression();
	Calendar calendar = new GregorianCalendar();
	calendar.setTime(new Date());
	rightExpression.setText("\" (C) " + calendar.get(Calendar.YEAR) + " \" + $R{" +
	ApplicationBean.getInstance().getLicenseHolder() + " - " + RESOURCE_KEYS.RIGHTS + "}");
	rightText.setExpression(rightExpression);
	band.addElement(rightText);
	JRDesignTextField pageText = new JRDesignTextField();
	pageText.setX(720);
	pageText.setY(0);
	pageText.setWidth(60);
	pageText.setHeight(15);
	pageText.setHorizontalTextAlign(HorizontalTextAlignEnum.RIGHT);
	JRDesignExpression pageExpression = new JRDesignExpression();
	pageExpression.setText("$R{" + RESOURCE_KEYS.PAGE + "} + \" \" + $V{PAGE_NUMBER}");
	pageText.setExpression(pageExpression);
	band.addElement(pageText);
	return band;
}
 
开发者ID:trackplus,项目名称:Genji,代码行数:33,代码来源:ReportOverviewJasperDesign.java

示例7: createDetailForSummary

import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
/**
 * Create a detail section in a {@link JasperReport}. Checks the {@link JasperReport} fields for a
 * {@link Detail} annotation and processes that {@link Detail} field.
 */
protected JRBand createDetailForSummary(final ReportInfo report) throws Exception {
    final JRDesignBand retval = new JRDesignBand();

    int maxHeight = DETAIL_HEIGHT;
    LOG.debug("Summary: Initial height is "+ DETAIL_HEIGHT);

    retval.setHeight(CELL_HEIGHT + 5);

    LOG.debug("Summary: Detail band has height of "+ maxHeight);
    int y = 0;

    LOG.info("Summary: Adding fields for detail");
    final Field summaryField = getFieldWithAnnotation(report, Summary.class);
    if (isCrosstab(summaryField)) {
        // If the summary has a crosstab, then we want to use the Summary section for rendering the crosstab.
        final Collection<JRChild> elements = processFields(report, Summary.class, Crosstab.class);
        for (final JRChild element : elements) {
            final JRDesignCrosstab crosstab = (JRDesignCrosstab) element;

            LOG.debug("Adding crosstab to summary "+ crosstab+ " with height "+ crosstab.getHeight());
            crosstab.setY(y);
            retval.addElement(crosstab);
            y += crosstab.getHeight() + PAGEHEADER_HEIGHT;
            retval.setHeight(y);
        }
    }
    else {
        // No crosstab, so use the detail
        final JRDesignTextField nameField = normal("$F{name}").toTextField();
        addDesignElementTo(retval, nameField, (CELL_WIDTH * 3 + 5) * 0, 0, CELL_WIDTH * 3, CELL_HEIGHT);

        final JRDesignTextField amountField = normal("$F{amount}").toTextField(java.math.BigDecimal.class);
        addDesignElementTo(retval, amountField, (CELL_WIDTH * 3 + 5) * 1, 0, CELL_WIDTH * 3, CELL_HEIGHT);
    }

    return retval;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:42,代码来源:TravelReportFactoryServiceImpl.java

示例8: addColumnHeaderToBand

import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的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);
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:39,代码来源:ReportBuilderUtils.java

示例9: addAlternativeRowBackground

import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
private static void addAlternativeRowBackground(int width, int height, JRDesignBand band) {
	JRDesignStaticText alt = new JRDesignStaticText();
	alt.setBackcolor(new Color(240, 240, 250));
	alt.setPrintWhenExpression(new JRDesignExpression("new java.lang.Boolean(($V{REPORT_COUNT}.intValue() % 2)==0)"));
	alt.setWidth(width);
	alt.setHeight(height);
	alt.setMode(ModeEnum.OPAQUE);
	alt.setStretchType(StretchTypeEnum.RELATIVE_TO_BAND_HEIGHT);
	band.addElement(alt);
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:11,代码来源:ReportBuilderUtils.java

示例10: addParametersToDisplayReportParameters

import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的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

示例11: addSummaryGroup

import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
protected void addSummaryGroup(List<FillColumn> fillColumns)
{
	JRDesignGroup summaryGroup = new JRDesignGroup();
	summaryGroup.setName(SUMMARY_GROUP_NAME);//TODO check for uniqueness
	
	JRDesignBand groupFooter = new JRDesignBand();
	groupFooter.setSplitType(SplitTypeEnum.PREVENT);
	groupFooter.setHeight(pageFooter.getHeight());
	
	// we need to put everything in a frame so that we can tell the frame
	// not to print when there are no detail bands on the current page
	// 
	// we can't do that directly to the band since its print when expression
	// is evaluated too soon
	JRDesignFrame footerFrame = new JRDesignFrame();
	UUID uuid = DigestUtils.instance().deriveUUID(
			fillContext.getComponentElement().getUUID(), 
			BandTypeEnum.GROUP_FOOTER + "-" + SUMMARY_GROUP_NAME);
	footerFrame.setUUID(uuid);
	footerFrame.setX(0);
	footerFrame.setY(0);
	footerFrame.setWidth(computeTableWidth(fillColumns));
	footerFrame.setHeight(pageFooter.getHeight());
	footerFrame.getLineBox().setPadding(0);
	footerFrame.getLineBox().getPen().setLineWidth(0f);
	footerFrame.setRemoveLineWhenBlank(true);
	
	JRDesignExpression footerPrintWhen = builtinEvaluatorFactory.createExpression(new SummaryGroupFooterPrintWhenEvaluator());
	footerFrame.setPrintWhenExpression(footerPrintWhen);
	
	// clone the contents of the page footer in the frame
	List<JRChild> footerElements = pageFooter.getChildren();
	for (Iterator<JRChild> iterator = footerElements.iterator(); iterator
			.hasNext();)
	{
		JRChild child = iterator.next();
		JRChild childClone = (JRChild) child.clone(footerFrame);
		if (childClone instanceof JRElement)
		{
			footerFrame.addElement((JRElement) childClone);
		}
		else if (childClone instanceof JRElementGroup)
		{
			footerFrame.addElementGroup((JRElementGroup) childClone);
		}
		else
		{
			throw 
				new JRRuntimeException(
					EXCEPTION_MESSAGE_KEY_UNKNOWN_CHILD_TYPE,  
					new Object[]{childClone.getClass().getName()} 
					);
		}
	}
	
	groupFooter.addElement(footerFrame);
	((JRDesignSection) summaryGroup.getGroupFooterSection()).addBand(groupFooter);
	
	mainDataset.addScriptlet(TABLE_SCRIPTLET_NAME, TableReportScriptlet.class);
	mainDataset.addFirstGroup(summaryGroup);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:62,代码来源:TableReport.java

示例12: switchBands

import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
/**
 * Switch bands.
 * 
 * @param cBand
 *          the c band
 * @param pBand
 *          the band
 */
private void switchBands(JRDesignBand cBand, JRDesignBand pBand) {
	// get guides
	MGraphicElement n = (MGraphicElement) SelectionHelper.getNode(jrElement);
	ReportRulerGuide vg = n.getVerticalGuide();
	ReportRulerGuide hg = n.getHorizontalGuide();
	int valign = 0;
	int halign = 0;
	if (hg != null) {
		halign = hg.getAlignment(n);
		hg.detachPart(n);
	}
	if (vg != null) {
		valign = vg.getAlignment(n);
		vg.detachPart(n);
	}
	boolean isSelected = false;
	if (firstTime)
		isSelected = SelectionHelper.isSelected(jrElement);
	JRElement[] elements = cBand.getElements();
	for (int i = 0; i < elements.length; i++) {
		if (elements[i] == jrElement) {
			oldIndex = i;
			break;
		}
	}
	cBand.removeElement(jrElement);
	pBand.addElement(jrElement);

	if (vg != null || hg != null) {
		n = (MGraphicElement) SelectionHelper.getNode(jrElement);
		if (hg != null) {
			hg.attachPart(n, halign);
		}
		if (vg != null) {
			vg.attachPart(n, valign);
		}
	}
	// set guides
	if (firstTime && isSelected) {
		SelectionHelper.setSelection(jrElement, true);
		firstTime = false;
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:52,代码来源:SetConstraintCommand.java

示例13: addDetailBand

import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
static int addDetailBand(ODLTableDefinition table, int elementWidth, boolean isHeaderRowForSubreport, JasperDesign ret) {

		// add details
		JRDesignSection detailSection = (JRDesignSection) ret.getDetailSection();
		JRDesignBand band = new JRDesignBand();
		List<Double> colWidths = getColumnWidths(table, elementWidth);
		
		// decide on the row height.. set differently if have images; assume images are square
		int headerHeight=0;
		int rowHeight = 18;
		if (isHeaderRowForSubreport) {
			headerHeight = 22;
			rowHeight = 24;
			
			// repeat header for each master report element
			addColumnHeaderToBand(table, elementWidth, band);
		}
		
		// make row taller if we have an image, based on making the image square
		int nc = table.getColumnCount();
		for (int i = 0; i < nc; i++) {
			if (table.getColumnType(i) == ODLColumnType.IMAGE) {
				rowHeight = Math.max(rowHeight, (int)Math.ceil(colWidths.get(i)));
			}
		}
		
		// Add alternating row background BEFORE column data (so drawn behind)
		if (!isHeaderRowForSubreport) {
			addAlternativeRowBackground(elementWidth, rowHeight, band);
		}

		// Add column data
		if (nc > 0) {
			double dx=0;
			for (int i = 0; i < nc; i++) {
				int x = (int) Math.round(dx);

				JRDesignElement element;
				if (table.getColumnType(i) == ODLColumnType.IMAGE) {
					element = createImageField(table, i);

				} else {
					JRDesignTextField textField = createTextField(table, i);

					// make bigger if this is the title row for a subreport
					if (isHeaderRowForSubreport) {
						textField.setFontSize(16);
						textField.setBold(true);
					}

					element = textField;
				}

				element.setX(x);
				element.setY(headerHeight);
				element.setWidth((int) Math.floor(colWidths.get(i)));
				element.setHeight(rowHeight);

				if (isHeaderRowForSubreport) {
					//element.setY(0);
					element.setStretchType(StretchTypeEnum.NO_STRETCH);
				} else {
					element.setStretchType(StretchTypeEnum.RELATIVE_TO_BAND_HEIGHT);
				}

				band.addElement(element);
				dx += colWidths.get(i);
			}
		}

		band.setHeight(headerHeight + rowHeight);
		detailSection.addBand(band);
		
		return headerHeight + rowHeight;
	}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:76,代码来源:ReportBuilderUtils.java

示例14: addPageFooter

import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
static void addPageFooter( int elementWidth, JasperDesign ret) {
	JRDesignBand band = new JRDesignBand();
	band.setHeight(14);

	int height = 13;
	int joinPoint = 40;
	Color backCol = new Color(230, 230, 230);
	JRDesignTextField pageXOf = new JRDesignTextField();
	pageXOf.setWidth(elementWidth - joinPoint);
	pageXOf.setHeight(height);
	pageXOf.setBackcolor(backCol);
	pageXOf.setExpression(new JRDesignExpression("\"Page \"+$V{PAGE_NUMBER}+\" of\""));
	pageXOf.setMode(ModeEnum.OPAQUE);
	pageXOf.setHorizontalAlignment(HorizontalAlignEnum.RIGHT);
	band.addElement(pageXOf);

	JRDesignTextField pageN = new JRDesignTextField();
	pageN.setWidth(joinPoint);
	pageN.setX(elementWidth - joinPoint);
	pageN.setHeight(height);
	pageN.setMode(ModeEnum.OPAQUE);
	pageN.setEvaluationTime(EvaluationTimeEnum.REPORT);
	pageN.setBackcolor(backCol);
	pageN.setHorizontalAlignment(HorizontalAlignEnum.LEFT);
	pageN.setExpression(new JRDesignExpression("\" \" +$V{PAGE_NUMBER}"));
	band.addElement(pageN);

	JRDesignTextField date = new JRDesignTextField();
	date.setHeight(height);
	date.setWidth(200);
	date.setPattern("EEEEE dd MMMMM yyyy");
	date.setExpression(new JRDesignExpression("new java.util.Date()"));
	band.addElement(date);

	JRDesignTextField odl = new JRDesignTextField();
	odl.setWidth(elementWidth);
	odl.setHeight(height);
	odl.setHorizontalAlignment(HorizontalAlignEnum.CENTER);
	odl.setExpression(new JRDesignExpression("\"Created by ODL Studio with maps � OpenStreetMap\""));
	band.addElement(odl);

	ret.setPageFooter(band);
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:44,代码来源:ReportBuilderUtils.java

示例15: addTitle

import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
static void addTitle(String title, int elementWidth,boolean hasHeaderMap, boolean hasDetails,JasperDesign ret) {
		JRDesignBand band = new JRDesignBand();

		int titleHeight = 50;
		band.setHeight(titleHeight);

		JRDesignTextField textField = new JRDesignTextField();
		textField.setBlankWhenNull(true);
		textField.setX(0);
		textField.setY(10);
		textField.setWidth(elementWidth);
		textField.setHeight(38);
		textField.setHorizontalAlignment(HorizontalAlignEnum.CENTER);
		textField.setFontSize(26);
		textField.setBold(true);
		JRDesignExpression expression = new JRDesignExpression();
		expression.setText("\"" + title + "\"");
		textField.setExpression(expression);
		band.addElement(textField);
		if(hasHeaderMap){
			double pictureWidthPoints = elementWidth;// / 10.0;
			double pictureXOffset = (elementWidth - pictureWidthPoints)/2.0; 
			double pictureWidthCM = pictureWidthPoints * ReportConstants.POINT_SIZE_IN_CM;
			
			// get picture height
			double pictureHeightCM = 10;
			if(hasDetails==false){
				// take whole page except for title
				double points = getAvailablePageHeight(ret) - titleHeight -40;
				pictureHeightCM = points * ReportConstants.POINT_SIZE_IN_CM;
			}
			else if (getAvailablePageHeight(ret) < getAvailableWidth(ret)){
				// landscape; make shorter
				pictureHeightCM = 6;
			}
			double pictureHeightPoints = pictureHeightCM / ReportConstants.POINT_SIZE_IN_CM;
			
			String imgExpression = "((" + ReportConstants.IMAGE_PROVIDER_INTERFACE + ")" + "$P{" + ReportConstants.HEADER_MAP_PROVIDER_PARAMETER + "})."
					+ ReportConstants.IMAGE_PROVIDER_INTERFACE_METHOD + "(" +pictureWidthCM +"," + pictureHeightCM + ",200)";
			JRDesignImage img = new JRDesignImage(null);
			
			img.setScaleImage(ScaleImageEnum.RETAIN_SHAPE);
			img.setExpression(new JRDesignExpression(imgExpression));
			img.setX((int)Math.round(pictureXOffset));
			img.setY(titleHeight);
			img.setWidth((int)Math.round(pictureWidthPoints));
			img.setHeight((int)Math.round(pictureHeightPoints));
			setImageBorder(img);
//			img.getLineBox().s
			band.setHeight(band.getHeight() + 10 +img.getHeight());
			band.addElement(img);
			
			//JRdesign
		}
		
		ret.setTitle(band);
	}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:58,代码来源:ReportBuilderUtils.java


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