@Override public void setStretchWithOverflow(boolean isStretch) { boolean old = this.isStretchWithOverflow; this.isStretchWithOverflow = isStretch; getEventSupport().firePropertyChange(JRBaseTextField.PROPERTY_STRETCH_WITH_OVERFLOW, old, this.isStretchWithOverflow); }
@Override protected void initializeProvidedProperties() { super.initializeProvidedProperties(); addProvidedProperties(JRDesignTextField.PROPERTY_EXPRESSION, Messages.common_expression); addProvidedProperties(JRDesignTextField.PROPERTY_EVALUATION_TIME, Messages.common_evaluation_time); addProvidedProperties(JRDesignStyle.PROPERTY_BLANK_WHEN_NULL, Messages.common_blank_when_null); addProvidedProperties(JRBaseTextField.PROPERTY_STRETCH_WITH_OVERFLOW, Messages.MTextField_stretch_with_overflow); addProvidedProperties(JRDesignStyle.PROPERTY_PATTERN, Messages.common_pattern); addProvidedProperties(JRDesignTextField.PROPERTY_PATTERN_EXPRESSION, Messages.MTextField_patternExpressionTitle); }
public void adjustTextMarkup(JasperReport jr) { JRSection detailSection = jr.getDetailSection(); for (JRBand band : detailSection.getBands()) { if (band.getElements().length > 0) { JRBaseTextField text = (JRBaseTextField) band.getElements()[0]; text.setBold(true); for (JRElement element : band.getElements()) { JRBaseTextField column = (JRBaseTextField) element; column.setMarkup(JRCommonText.MARKUP_HTML); } } } }
/** * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) */ public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); parent.setLayout(new GridLayout(2, false)); createWidget4Property(parent, JRDesignTextField.PROPERTY_EXPRESSION); IPropertyDescriptor pd = getPropertyDesriptor(JRDesignTextField.PROPERTY_EVALUATION_TIME); IPropertyDescriptor gpd = getPropertyDesriptor(JRDesignTextField.PROPERTY_EVALUATION_GROUP); getWidgetFactory().createCLabel(parent, pd.getDisplayName()); widgets.put(pd.getId(), new SPEvaluationTime(parent, this, pd, gpd)); GridData gd = new GridData(); gd.horizontalSpan = 2; createWidget4Property(parent, JRDesignStyle.PROPERTY_BLANK_WHEN_NULL,false).getControl().setLayoutData(gd); createWidget4Property(parent, JRBaseTextField.PROPERTY_STRETCH_WITH_OVERFLOW, false).getControl().setLayoutData(gd); createWidget4Property(parent, JRDesignStyle.PROPERTY_PATTERN); createWidget4Property(parent, JRDesignTextField.PROPERTY_PATTERN_EXPRESSION); }
/** * Creates the property descriptors. * * @param desc * the desc */ @Override public void createPropertyDescriptors(List<IPropertyDescriptor> desc, Map<String, Object> defaultsMap) { super.createPropertyDescriptors(desc, defaultsMap); evaluationTimeD = new JSSEnumPropertyDescriptor(JRDesignTextField.PROPERTY_EVALUATION_TIME, Messages.common_evaluation_time, EvaluationTimeEnum.class, NullEnum.NOTNULL); evaluationTimeD.setDescription(Messages.MTextField_evaluation_time_description); desc.add(evaluationTimeD); evalGroupD = new RWComboBoxPropertyDescriptor(JRDesignTextField.PROPERTY_EVALUATION_GROUP, Messages.MTextField_evaluation_group, new String[] { "" }, NullEnum.NULL); //$NON-NLS-1$ evalGroupD.setDescription(Messages.MTextField_evaluation_group_description); desc.add(evalGroupD); NullCheckBoxPropertyDescriptor blankWhenNullD = new NullCheckBoxPropertyDescriptor( JRDesignStyle.PROPERTY_BLANK_WHEN_NULL, Messages.common_blank_when_null); blankWhenNullD.setDescription(Messages.MTextField_blank_when_null_description); desc.add(blankWhenNullD); CheckBoxPropertyDescriptor stretchOverflowD = new CheckBoxPropertyDescriptor( JRBaseTextField.PROPERTY_STRETCH_WITH_OVERFLOW, Messages.MTextField_stretch_with_overflow, NullEnum.NOTNULL); stretchOverflowD.setDescription(Messages.MTextField_stretch_with_overflow_description); desc.add(stretchOverflowD); JRExpressionPropertyDescriptor exprD = new JRExpressionPropertyDescriptor(JRDesignTextField.PROPERTY_EXPRESSION, Messages.common_expression); exprD.setDescription(Messages.MTextField_expression_description); desc.add(exprD); exprD.setHelpRefBuilder(new HelpReferenceBuilder( "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#textFieldExpression")); //$NON-NLS-1$ JRExpressionPropertyDescriptor anchorNameExp = new JRExpressionPropertyDescriptor(JRDesignTextField.PROPERTY_ANCHOR_NAME_EXPRESSION, Messages.MTextField_anchorNameLabel); anchorNameExp.setDescription(Messages.MTextField_anchorNameDescription); desc.add(anchorNameExp); SpinnerPropertyDescriptor bookmarkLevel = new SpinnerPropertyDescriptor(JRDesignTextField.PROPERTY_BOOKMARK_LEVEL, Messages.MTextField_bookmarkLevelLabel); bookmarkLevel.setDescription(Messages.MTextField_bookmarkLevelDescription); bookmarkLevel.setHelpRefBuilder(new HelpReferenceBuilder("net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#chart_bookmarkLevel")); //$NON-NLS-1$ desc.add(bookmarkLevel); PatternPropertyDescriptor patternD = new PatternPropertyDescriptor(JRDesignStyle.PROPERTY_PATTERN, Messages.common_pattern); patternD.setDescription(Messages.MTextField_pattern_description); desc.add(patternD); JRExpressionPropertyDescriptor pexprD = new JRExpressionPropertyDescriptor( JRDesignTextField.PROPERTY_PATTERN_EXPRESSION, Messages.MTextField_patternExpressionTitle); pexprD.setDescription("Pattern expression"); //$NON-NLS-1$ desc.add(pexprD); pexprD.setHelpRefBuilder(new HelpReferenceBuilder( "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#patternExpression")); //$NON-NLS-1$ setHelpPrefix(desc, "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#textField"); //$NON-NLS-1$ if (mHyperLink == null) mHyperLink = new MHyperLink(null); mHyperLink.createPropertyDescriptors(desc, defaultsMap); setHelpPrefix(desc, "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#textField"); //$NON-NLS-1$ patternD.setCategory(Messages.MTextField_textfield_category); exprD.setCategory(Messages.MTextField_textfield_category); evaluationTimeD.setCategory(Messages.MTextField_textfield_category); evalGroupD.setCategory(Messages.MTextField_textfield_category); blankWhenNullD.setCategory(Messages.MTextField_textfield_category); stretchOverflowD.setCategory(Messages.MTextField_textfield_category); pexprD.setCategory(Messages.MTextField_textfield_category); defaultsMap.put(JRDesignTextField.PROPERTY_EVALUATION_TIME, EvaluationTimeEnum.NOW); defaultsMap.put(JRDesignStyle.PROPERTY_BLANK_WHEN_NULL, Boolean.FALSE); defaultsMap.put(JRBaseTextField.PROPERTY_STRETCH_WITH_OVERFLOW, Boolean.FALSE); }
@Override public Object getPropertyValue(Object id) { JRDesignTextField jrElement = (JRDesignTextField) getValue(); if (id.equals(JRDesignTextField.PROPERTY_EXPRESSION)) return ExprUtil.getExpression(jrElement.getExpression()); if (id.equals(JRDesignTextField.PROPERTY_PATTERN_EXPRESSION)) return ExprUtil.getExpression(jrElement.getPatternExpression()); if (id.equals(JRDesignTextField.PROPERTY_EVALUATION_TIME)) return evaluationTimeD.getEnumValue(jrElement.getEvaluationTimeValue()); if (id.equals(JRDesignStyle.PROPERTY_BLANK_WHEN_NULL)) return jrElement.isOwnBlankWhenNull(); if (id.equals(JRBaseTextField.PROPERTY_STRETCH_WITH_OVERFLOW)) return new Boolean(jrElement.isStretchWithOverflow()); if (id.equals(JRDesignStyle.PROPERTY_PATTERN)) return jrElement.getOwnPattern(); if (id.equals(JRDesignTextField.PROPERTY_EVALUATION_GROUP)) { if (jrElement.getEvaluationGroup() != null) return jrElement.getEvaluationGroup().getName(); return ""; //$NON-NLS-1$ } // hyperlink -------------------------------------- if (id.equals(JRDesignHyperlink.PROPERTY_LINK_TARGET)) return jrElement.getLinkTarget(); if (id.equals(JRDesignHyperlink.PROPERTY_LINK_TYPE)) return jrElement.getLinkType(); if (id.equals(JRDesignHyperlink.PROPERTY_HYPERLINK_PARAMETERS)) { if (propertyDTO == null) { propertyDTO = new ParameterDTO(); propertyDTO.setJasperDesign(getJasperDesign()); propertyDTO.setValue(jrElement.getHyperlinkParameters()); } return propertyDTO; } if (id.equals(JRDesignHyperlink.PROPERTY_HYPERLINK_ANCHOR_EXPRESSION)) { return ExprUtil.getExpression(jrElement.getHyperlinkAnchorExpression()); } if (id.equals(JRDesignHyperlink.PROPERTY_HYPERLINK_PAGE_EXPRESSION)) { return ExprUtil.getExpression(jrElement.getHyperlinkPageExpression()); } if (id.equals(JRDesignHyperlink.PROPERTY_HYPERLINK_REFERENCE_EXPRESSION)) { return ExprUtil.getExpression(jrElement.getHyperlinkReferenceExpression()); } if (id.equals(JRDesignHyperlink.PROPERTY_HYPERLINK_TOOLTIP_EXPRESSION)) { return ExprUtil.getExpression(jrElement.getHyperlinkTooltipExpression()); } if (id.equals(JRDesignHyperlink.PROPERTY_HYPERLINK_WHEN_EXPRESSION)) { return ExprUtil.getExpression(jrElement.getHyperlinkWhenExpression()); } if (id.equals(JRDesignTextField.PROPERTY_ANCHOR_NAME_EXPRESSION)){ return ExprUtil.getExpression(jrElement.getAnchorNameExpression()); } if (id.equals(JRDesignTextField.PROPERTY_BOOKMARK_LEVEL)){ return jrElement.getBookmarkLevel(); } return super.getPropertyValue(id); }
@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); }
@Override public String getName() { return JRBaseTextField.PROPERTY_STRETCH_WITH_OVERFLOW; }