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


Java JRDesignTextField.setExpression方法代码示例

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


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

示例1: createDetailCells

import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
private void createDetailCells(JRDesignCrosstab jdc) {
	List<JRCrosstabCell> cells = jdc.getCellsList();
	JRCrosstabMeasure[] measures = jdc.getMeasures();
	if (measures != null && cells != null)
		for (JRCrosstabCell c : cells) {
			int y = 0;
			if (c.getHeight() != null && measures.length > 0) {
				int h = c.getHeight() / measures.length;
				for (int i = 0; i < measures.length; i++) {
					JRDesignExpression exp = new JRDesignExpression();
					exp.setText("$V{" + measures[i].getName() + "}"); //$NON-NLS-1$ //$NON-NLS-2$

					JRDesignTextField tf = (JRDesignTextField) new MTextField()
							.createJRElement(getConfig().getJasperDesign());
					tf.setX(0);
					tf.setY(y);
					tf.setWidth(c.getWidth());
					tf.setHeight(h);
					tf.setExpression(exp);
					((JRDesignCellContents) c.getContents()).addElement(tf);
					y += h;
				}
			}
		}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:26,代码来源:CrosstabWizard.java

示例2: createField

import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
private JRDesignTextField createField(JasperDesign jd, JRDesignExpression exp, int w, int h, String styleName)
{
    JRDesignTextField element = new JRDesignTextField();
    element.setX(0);
    element.setY(0);
    element.setWidth(w);
    element.setHeight(h);
    
    if (styleName != null && jd.getStylesMap().containsKey(styleName))
    {
        element.setStyle( (JRStyle) jd.getStylesMap().get(styleName) );
    }
    
    try {
        CreateTextFieldAction.setMatchingClassExpression(exp,exp.getValueClassName(), true);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    element.setExpression(exp);
    return element;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:22,代码来源:NewTypesUtils.java

示例3: 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

示例4: addFieldValue

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

示例5: createIconLabelElement

import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
protected JRDesignComponentElement createIconLabelElement(SortOrderEnum order, JRFillTextElement textElement,
		BuiltinExpressionEvaluatorFactory builtinExpressions)
{
	JRTextElement parentElement = (JRTextElement) textElement.getParent();
	
	JRDesignComponentElement designIconLabelElement = 
		IconLabelComponentUtil.getInstance(filler.getJasperReportsContext()).createIconLabelComponentElement(parentElement, textElement);
	IconLabelComponent iconLabelComponent = (IconLabelComponent)designIconLabelElement.getComponent();

	JRDesignTextField labelTextField = (JRDesignTextField)iconLabelComponent.getLabelTextField();
	JRDesignTextField iconTextField = (JRDesignTextField)iconLabelComponent.getIconTextField();

	designIconLabelElement.setStyle(textElement.getInitStyle());
	labelTextField.setStyle(textElement.getInitStyle());
	iconTextField.setStyle(textElement.getInitStyle());

	if (textElement instanceof JRTextField) 
	{
		labelTextField.setExpression(((JRTextField) textElement).getExpression());
	}
	else if (textElement instanceof JRStaticText) 
	{
		String text = ((JRStaticText) textElement).getText();
		labelTextField.setExpression(builtinExpressions.createConstantExpression(text));
	}
	
	String iconText =
			order == SortOrderEnum.ASCENDING ? filler.getPropertiesUtil().getProperty(TableReport.PROPERTY_UP_ARROW_CHAR)
			: (order == SortOrderEnum.DESCENDING ? filler.getPropertiesUtil().getProperty(TableReport.PROPERTY_DOWN_ARROW_CHAR) : "");
	iconTextField.setExpression(builtinExpressions.createConstantExpression(" " + iconText)); 
	
	designIconLabelElement.getPropertiesMap().setProperty(
			MatcherExporterFilter.PROPERTY_MATCHER_EXPORT_FILTER_KEY, 
			TableReport.TABLE_HEADER_ICON_LABEL_MATCHER_EXPORT_KEY
			);
	
	return designIconLabelElement;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:39,代码来源:JRFillCrosstab.java

示例6: addIconLabelComponent

import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
protected void addIconLabelComponent(Column column, JRDesignFrame frame, String suffix)
{
	List<JRChild> children = frame.getChildren();
	if (children.size() > 0)
	{
		JRBaseTextElement headerTextElement = (JRBaseTextElement)children.get(0);
		if (headerTextElement != null) 
		{
			JRComponentElement componentElement = 
				IconLabelComponentUtil.getInstance(fillContext.getFiller().getJasperReportsContext()).createIconLabelComponentElement(headerTextElement);
			IconLabelComponent iconLabelComponent = (IconLabelComponent)componentElement.getComponent();
			
			JRDesignTextField labelTextField = (JRDesignTextField)iconLabelComponent.getLabelTextField();
			if (headerTextElement instanceof JRTextField) 
			{
				labelTextField.setExpression(((JRTextField) headerTextElement).getExpression());
			}
			else if (headerTextElement instanceof JRStaticText) 
			{
				labelTextField.setExpression(builtinEvaluatorFactory.createConstantExpression(((JRStaticText)headerTextElement).getText()));
			}

			JRDesignTextField iconTextField = (JRDesignTextField)iconLabelComponent.getIconTextField();
			iconTextField.setExpression(builtinEvaluatorFactory.createConstantExpression(suffix));
			
			componentElement.getPropertiesMap().setProperty(MatcherExporterFilter.PROPERTY_MATCHER_EXPORT_FILTER_KEY, TABLE_HEADER_ICON_LABEL_MATCHER_EXPORT_KEY);
			
			JRBaseElement element = (JRBaseElement)frame.getChildren().get(0);
			element.getPropertiesMap().setProperty(MatcherExporterFilter.PROPERTY_MATCHER_EXPORT_FILTER_KEY, TABLE_HEADER_LABEL_MATCHER_EXPORT_KEY);

			//frame.getChildren().remove(0);
			frame.getChildren().add(componentElement);
		}
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:36,代码来源:TableReport.java

示例7: execute

import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
@Override
public void execute() {
	MTextField mElement = new MTextField();
	JRDesignTextField textElement =  mElement.createJRElement(parent.getJasperDesign());
	String measureName = "$V{"+(String)child.getPropertyActualValue(JRDesignCrosstabMeasure.PROPERTY_NAME)+"}";
	textElement.setExpression(new JRDesignExpression(measureName));
	newElement = textElement;
	parent.getValue().addElement(textElement);
	setElementBounds(textElement,mElement);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:11,代码来源:CreateMeasureFieldCommand.java

示例8: createGroupCell

import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
/**
 * Create a group column of the table, with a width of the whole table. the content in the new column
	 * The size and position of the content will be relative to the width of the new column that 
 * may be different from the one of the template.
 * 
 *  
 * @param groupCell cell of the group where the element read from the template are placed
 * @param groupIndex number of the group
 * @param newGroupWidth width of the group in the resulting table
 * @param groupExpression the expression of the groupfield
 * @param jd the jasperdesign
 */
private void createGroupCell(DesignCell groupCell, int groupIndex, int newGroupWidth, JRDesignExpression groupExpression, JasperDesign jd){
	List<JRDesignElement> groupHeaderContent = null;
	if (tableGroupField.size() > groupIndex){
		groupHeaderContent = tableGroupField.get(groupIndex);
	} else if (!tableGroupField.isEmpty()){
		groupHeaderContent = tableGroupField.get(tableGroupField.size()-1);
	}
	if (groupHeaderContent != null){
		for(JRDesignElement element : groupHeaderContent){
			JRDesignElement copyElement = (JRDesignElement)element.clone();
			copyElement.setX(getRelativeWidth(newGroupWidth, copyElement.getX(), templateGroupWidth));
			copyElement.setWidth(getRelativeWidth(newGroupWidth, copyElement.getWidth(), templateGroupWidth));
			
			if (copyElement instanceof JRDesignTextField){
				JRDesignTextField field = (JRDesignTextField)copyElement;
				if (isGroupPlaceholder(field)){
					field.setExpression(groupExpression);
				}
			}
			
			groupCell.addElement(copyElement);
		}
	} else {
		JRDesignTextField sText = new MTextField().createJRElement(jd);
		sText.setWidth(newGroupWidth);
		sText.setHeight(groupCell.getHeight());
		sText.setX(0);
		sText.setY(0);
		sText.setExpression(groupExpression);
		groupCell.addElement(sText);
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:45,代码来源:TableTemplateEngine.java

示例9: createJRElement

import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
@Override
public JRDesignTextField createJRElement(JasperDesign jasperDesign) {
	JRDesignTextField jrDesignTextField = new JRDesignTextField();
	jrDesignTextField.setX(0);
	jrDesignTextField.setY(0);
	jrDesignTextField.setExpression(new JRDesignExpression("\"".concat(Messages.MTextField_common_text_field).concat("\""))); //$NON-NLS-1$

	DefaultManager.INSTANCE.applyDefault(this.getClass(), jrDesignTextField);

	return jrDesignTextField;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:12,代码来源:MTextField.java

示例10: createJRElement

import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
@Override
public JRDesignTextField createJRElement(JasperDesign jasperDesign) {
	JRDesignTextField jrDesignTextField = new JRDesignTextField();
	JRDesignExpression expression = new JRDesignExpression();
	expression.setText("$V{PAGE_NUMBER}"); //$NON-NLS-1$
	jrDesignTextField.setExpression(expression);
	jrDesignTextField.setEvaluationTime(EvaluationTimeEnum.REPORT);
	return jrDesignTextField;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:10,代码来源:MTotalPages.java

示例11: createJRElement

import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
@Override
public JRDesignTextField createJRElement(JasperDesign jasperDesign) {
	JRDesignTextField jrDesignTextField = new JRDesignTextField();
	JRDesignExpression expression = new JRDesignExpression();
	expression.setText("new java.util.Date()"); //$NON-NLS-1$
	jrDesignTextField.setExpression(expression);
	jrDesignTextField.setPattern("HH:mm");
	return jrDesignTextField;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:10,代码来源:MTime.java

示例12: createJRElement

import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
@Override
public JRDesignTextField createJRElement(JasperDesign jasperDesign) {
	JRDesignTextField jrDesignTextField = new JRDesignTextField();
	JRDesignExpression expression = new JRDesignExpression();
	expression.setText("$V{PAGE_NUMBER}"); //$NON-NLS-1$
	jrDesignTextField.setExpression(expression);
	jrDesignTextField.setEvaluationTime(EvaluationTimeEnum.NOW);
	return jrDesignTextField;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:10,代码来源:MPageNumber.java

示例13: createJRElement

import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
@Override
public JRDesignTextField createJRElement(JasperDesign jasperDesign) {
	JRDesignTextField jrDesignTextField = new JRDesignTextField();
	JRDesignExpression expression = new JRDesignExpression();
	expression.setText("new java.util.Date()"); //$NON-NLS-1$
	jrDesignTextField.setExpression(expression);
	jrDesignTextField.setPattern("MMMMM dd, yyyy"); //$NON-NLS-1$
	return jrDesignTextField;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:10,代码来源:MDate.java

示例14: createTextField

import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
public static MTextField createTextField(String txtExp, String classExp) {
	MTextField src = new MTextField();
	JRDesignTextField tf = new JRDesignTextField();
	src.setValue(tf);

	JRDesignExpression jre = new JRDesignExpression();
	jre.setText(txtExp);
	tf.setExpression(jre);
	return src;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:11,代码来源:Tag.java

示例15: buildPageFooterBand

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


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