本文整理汇总了Java中net.sf.jasperreports.engine.design.JRDesignTextField.setBlankWhenNull方法的典型用法代码示例。如果您正苦于以下问题:Java JRDesignTextField.setBlankWhenNull方法的具体用法?Java JRDesignTextField.setBlankWhenNull怎么用?Java JRDesignTextField.setBlankWhenNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jasperreports.engine.design.JRDesignTextField
的用法示例。
在下文中一共展示了JRDesignTextField.setBlankWhenNull方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: trasnferProperties
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
@Override
public void trasnferProperties(JRElement target){
super.trasnferProperties(target);
JRDesignTextField jrSource = (JRDesignTextField) getValue();
JRDesignTextField jrTarget = (JRDesignTextField)target;
jrTarget.setBlankWhenNull(jrSource.isOwnBlankWhenNull());
jrTarget.setPattern(getStringClone(jrSource.getOwnPattern()));
jrTarget.setStretchWithOverflow(jrSource.isStretchWithOverflow());
}
示例3: createObject
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
@Override
public Object createObject(Attributes atts)
{
JRXmlLoader xmlLoader = (JRXmlLoader)digester.peek(digester.getCount() - 1);
JRDesignTextField textField = getTextField();
String isStretchWithOverflow = atts.getValue(JRXmlConstants.ATTRIBUTE_isStretchWithOverflow);
if (isStretchWithOverflow != null && isStretchWithOverflow.length() > 0)
{
textField.setStretchWithOverflow(Boolean.valueOf(isStretchWithOverflow).booleanValue());
}
EvaluationTimeEnum evaluationTime = EvaluationTimeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_evaluationTime));
if (evaluationTime != null)
{
textField.setEvaluationTime(evaluationTime);
}
if (textField.getEvaluationTimeValue() == EvaluationTimeEnum.GROUP)
{
xmlLoader.addGroupEvaluatedTextField(textField);
String groupName = atts.getValue(JRXmlConstants.ATTRIBUTE_evaluationGroup);
if (groupName != null)
{
JRDesignGroup group = new JRDesignGroup();
group.setName(groupName);
textField.setEvaluationGroup(group);
}
}
textField.setPattern(atts.getValue(JRXmlConstants.ATTRIBUTE_pattern));
String isBlankWhenNull = atts.getValue(JRXmlConstants.ATTRIBUTE_isBlankWhenNull);
if (isBlankWhenNull != null && isBlankWhenNull.length() > 0)
{
textField.setBlankWhenNull(Boolean.valueOf(isBlankWhenNull));
}
textField.setLinkType(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkType));
textField.setLinkTarget(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkTarget));
String bookmarkLevelAttr = atts.getValue(JRXmlConstants.ATTRIBUTE_bookmarkLevel);
if (bookmarkLevelAttr != null)
{
textField.setBookmarkLevel(Integer.parseInt(bookmarkLevelAttr));
}
return textField;
}
示例4: setPropertyValue
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
@Override
public void setPropertyValue(Object id, Object value) {
JRDesignTextField jrElement = (JRDesignTextField) getValue();
if (id.equals(JRDesignTextField.PROPERTY_EVALUATION_TIME))
jrElement.setEvaluationTime((EvaluationTimeEnum) evaluationTimeD.getEnumValue(value));
else if (id.equals(JRDesignTextField.PROPERTY_EVALUATION_GROUP)) {
if (value != null && !value.equals("")) { //$NON-NLS-1$
JRDesignDataset dataset = (JRDesignDataset)getElementDataset();
JRGroup group = (JRGroup) dataset.getGroupsMap().get(value);
jrElement.setEvaluationGroup(group);
} else
jrElement.setEvaluationGroup(null);
} else if (id.equals(JRDesignTextField.PROPERTY_EXPRESSION)){
jrElement.setExpression(ExprUtil.setValues(jrElement.getExpression(), value));
JRDesignExpression expression = (JRDesignExpression)jrElement.getExpression();
//When the expression changes update also the listeners
if (expression != null){
removeListeners(expression);
expression.getEventSupport().addPropertyChangeListener(new ExpressionNameChanged(this));
}
} else if (id.equals(JRDesignTextField.PROPERTY_PATTERN_EXPRESSION))
jrElement.setPatternExpression(ExprUtil.setValues(jrElement.getPatternExpression(), value));
else if (id.equals(JRDesignStyle.PROPERTY_BLANK_WHEN_NULL))
jrElement.setBlankWhenNull((Boolean) value);
else if (id.equals(JRDesignStyle.PROPERTY_PATTERN))
jrElement.setPattern((String) value);
else if (id.equals(JRBaseTextField.PROPERTY_STRETCH_WITH_OVERFLOW))
jrElement.setStretchWithOverflow(((Boolean) value).booleanValue());
else if (id.equals(JRDesignHyperlink.PROPERTY_LINK_TARGET))
jrElement.setLinkTarget((String) value);
else if (id.equals(JRDesignHyperlink.PROPERTY_LINK_TYPE))
jrElement.setLinkType((String) value);
else if (id.equals(JRDesignHyperlink.PROPERTY_HYPERLINK_ANCHOR_EXPRESSION))
jrElement.setHyperlinkAnchorExpression(ExprUtil.setValues(jrElement.getHyperlinkAnchorExpression(), value));
else if (id.equals(JRDesignHyperlink.PROPERTY_HYPERLINK_PAGE_EXPRESSION))
jrElement.setHyperlinkPageExpression(ExprUtil.setValues(jrElement.getHyperlinkPageExpression(), value));
else if (id.equals(JRDesignHyperlink.PROPERTY_HYPERLINK_REFERENCE_EXPRESSION))
jrElement.setHyperlinkReferenceExpression(ExprUtil.setValues(jrElement.getHyperlinkReferenceExpression(), value));
else if (id.equals(JRDesignHyperlink.PROPERTY_HYPERLINK_WHEN_EXPRESSION)) {
jrElement.setHyperlinkWhenExpression(ExprUtil.setValues(jrElement.getHyperlinkWhenExpression(), value));
} else if (id.equals(JRDesignHyperlink.PROPERTY_HYPERLINK_TOOLTIP_EXPRESSION))
jrElement.setHyperlinkTooltipExpression(ExprUtil.setValues(jrElement.getHyperlinkTooltipExpression(), value));
else if (id.equals(JRDesignTextField.PROPERTY_ANCHOR_NAME_EXPRESSION))
jrElement.setAnchorNameExpression(ExprUtil.setValues(jrElement.getAnchorNameExpression(), value));
else if (id.equals(JRDesignTextField.PROPERTY_BOOKMARK_LEVEL))
jrElement.setBookmarkLevel(value != null ? Integer.parseInt(value.toString()) : 0);
else if (id.equals(JRDesignHyperlink.PROPERTY_HYPERLINK_PARAMETERS)) {
if (value instanceof ParameterDTO) {
ParameterDTO v = (ParameterDTO) value;
JRHyperlinkParameter[] hyperlinkParameters = jrElement.getHyperlinkParameters();
if (hyperlinkParameters != null)
for (JRHyperlinkParameter prm : hyperlinkParameters)
jrElement.removeHyperlinkParameter(prm);
for (JRHyperlinkParameter param : v.getValue())
jrElement.addHyperlinkParameter(param);
propertyDTO = v;
}
} else
super.setPropertyValue(id, value);
}
示例5: copyInheritedTextFieldAttributes
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的package包/类
private static void copyInheritedTextFieldAttributes(JRDesignElement target, JRStyle style){
JRDesignTextField jrTarget = (JRDesignTextField)target;
if (jrTarget.isOwnBlankWhenNull() == null) jrTarget.setBlankWhenNull(style.isBlankWhenNull());
if (jrTarget.getOwnPattern() == null) jrTarget.setPattern(style.getPattern());
}
示例6: addTitle
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入方法依赖的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);
}