@Override public Object createObject(Attributes attributes) { JRXmlLoader xmlLoader = (JRXmlLoader)digester.peek(digester.getCount() - 1); JRDesignDataset dataset = new JRDesignDataset(xmlLoader.getJasperReportsContext(), false); dataset.setName(attributes.getValue(JRXmlConstants.ATTRIBUTE_name)); dataset.setScriptletClass(attributes.getValue(JRXmlConstants.ATTRIBUTE_scriptletClass)); dataset.setResourceBundle(attributes.getValue(JRXmlConstants.ATTRIBUTE_resourceBundle)); WhenResourceMissingTypeEnum whenResourceMissingType = WhenResourceMissingTypeEnum.getByName(attributes.getValue(JRXmlConstants.ATTRIBUTE_whenResourceMissingType)); if (whenResourceMissingType != null) { dataset.setWhenResourceMissingType(whenResourceMissingType); } String uuid = attributes.getValue(JRXmlConstants.ATTRIBUTE_uuid); if (uuid != null) { dataset.setUUID(UUID.fromString(uuid)); } return dataset; }
public void writeDataset(JRDataset dataset) throws IOException { writer.startElement(JRXmlConstants.ELEMENT_subDataset, getNamespace()); writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, dataset.getName()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_scriptletClass, dataset.getScriptletClass()); writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_resourceBundle, dataset.getResourceBundle()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_whenResourceMissingType, dataset.getWhenResourceMissingTypeValue(), WhenResourceMissingTypeEnum.NULL); if ( isNewerVersionOrEqual(JRConstants.VERSION_4_6_0) && !isExcludeUuids() ) { writer.addAttribute(JRXmlConstants.ATTRIBUTE_uuid, dataset.getUUID().toString()); } writeProperties(dataset); if (isNewerVersionOrEqual(JRConstants.VERSION_6_3_1)) { writePropertyExpressions(dataset.getPropertyExpressions()); } writeDatasetContents(dataset); writer.closeElement(); }
/** * */ public void writeDataset( JRDataset dataset, String datasetName) { if(dataset != null) { write( "JRDesignDataset " + datasetName + " = new JRDesignDataset(" + dataset.isMainDataset() + ");\n"); write( datasetName + ".setName(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(dataset.getName())); write( datasetName + ".setScriptletClass(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(dataset.getScriptletClass())); write( datasetName + ".setResourceBundle(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(dataset.getResourceBundle())); write( datasetName + ".setWhenResourceMissingType({0});\n", dataset.getWhenResourceMissingTypeValue(), WhenResourceMissingTypeEnum.NULL); writeProperties( dataset, datasetName); writePropertyExpressions( dataset.getPropertyExpressions(), datasetName); writeDatasetContents( dataset, datasetName); flush(); } }
/** * Initializes the evaluator by setting the parameter, field and variable objects. * * @param parametersMap the parameters indexed by name * @param fieldsMap the fields indexed by name * @param variablesMap the variables indexed by name * @param resourceMissingType the resource missing type * @throws JRException */ @Override public void init( Map<String, JRFillParameter> parametersMap, Map<String, JRFillField> fieldsMap, Map<String, JRFillVariable> variablesMap, WhenResourceMissingTypeEnum resourceMissingType, boolean ignoreNPE ) throws JRException { whenResourceMissingType = resourceMissingType; this.ignoreNPE = ignoreNPE; resourceBundle = parametersMap.get(JRParameter.REPORT_RESOURCE_BUNDLE); locale = parametersMap.get(JRParameter.REPORT_LOCALE); functions = new HashMap<String, FunctionSupport>(); functionContext = new FillFunctionContext(parametersMap); customizedInit(parametersMap, fieldsMap, variablesMap); defaultValues = new FillExpressionDefaultValues(this, parametersMap, fieldsMap, variablesMap); oldValues = new FillExpressionOldValues(this, parametersMap, fieldsMap, variablesMap); estimatedValues = new FillExpressionEstimatedValues(this, parametersMap, fieldsMap, variablesMap); }
static JasperDesign createEmpty(String tablename, int pageWidth, int pageHeight, boolean margins) { JasperDesign ret = new JasperDesign(); ret.setName(Strings.removeExportIllegalChars(AppConstants.ORG_NAME + " - " + tablename)); ret.setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL); ret.setWhenResourceMissingType(WhenResourceMissingTypeEnum.EMPTY); ret.setOrientation(OrientationEnum.LANDSCAPE); ret.setPageWidth(pageWidth); ret.setPageHeight(pageHeight); if (!margins) { ret.setLeftMargin(0); ret.setRightMargin(0); ret.setTopMargin(0); ret.setBottomMargin(0); } ret.setColumnWidth(Math.min(getAvailableWidth(ret), ret.getColumnWidth())); return ret; }
@Override public void setWhenResourceMissingType(WhenResourceMissingTypeEnum whenResourceMissingTypeValue) { Object old = this.whenResourceMissingTypeValue; this.whenResourceMissingTypeValue = whenResourceMissingTypeValue; getEventSupport().firePropertyChange(PROPERTY_WHEN_RESOURCE_MISSING_TYPE, old, this.whenResourceMissingTypeValue); }
@SuppressWarnings("deprecation") private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2) { whenResourceMissingTypeValue = WhenResourceMissingTypeEnum.getByValue(whenResourceMissingType); } }
/** * Initializes the calculator. * * @param dataset the dataset this calculator is used for * @throws JRException */ protected void init(JRFillDataset dataset) throws JRException { this.dataset = dataset; parsm = dataset.parametersMap; fldsm = dataset.fieldsMap; varsm = dataset.variablesMap; variables = dataset.variables; groups = dataset.groups; datasets = dataset.elementDatasets; pageNumber = varsm.get(JRVariable.PAGE_NUMBER); columnNumber = varsm.get(JRVariable.COLUMN_NUMBER); WhenResourceMissingTypeEnum whenResourceMissingType = dataset.getWhenResourceMissingTypeValue(); boolean ignoreNPE = JRPropertiesUtil.getInstance(getFillDataset().getJasperReportsContext()) .getBooleanProperty( getFillDataset(), JREvaluator.PROPERTY_IGNORE_NPE, true ); evaluator.init(parsm, fldsm,varsm, whenResourceMissingType, ignoreNPE); legacyBandEvaluationEnabled = JRPropertiesUtil.getInstance(getFillDataset().getJasperReportsContext()) .getBooleanProperty( PROPERTY_LEGACY_BAND_EVALUATION_ENABLED ); }
void init( Map<String, JRFillParameter> parametersMap, Map<String, JRFillField> fieldsMap, Map<String, JRFillVariable> variablesMap, WhenResourceMissingTypeEnum resourceMissingType, boolean ignoreNPE ) throws JRException;
@Override public void init(Map<String, JRFillParameter> parametersMap, Map<String, JRFillField> fieldsMap, Map<String, JRFillVariable> variablesMap, WhenResourceMissingTypeEnum resourceMissingType) throws JRException { // NOP }
@Override public void init(Map<String, JRFillParameter> parametersMap, Map<String, JRFillField> fieldsMap, Map<String, JRFillVariable> variablesMap, WhenResourceMissingTypeEnum resourceMissingType, boolean ignoreNPE) throws JRException { decorated.init(parametersMap, fieldsMap, variablesMap, resourceMissingType, ignoreNPE); for (BuiltinExpressionEvaluator builtinEvaluator : builtinEvaluators.values()) { builtinEvaluator.init(parametersMap, fieldsMap, variablesMap, resourceMissingType); } }
@Override public void init(Map<String, JRFillParameter> parametersMap, Map<String, JRFillField> fieldsMap, Map<String, JRFillVariable> variablesMap, WhenResourceMissingTypeEnum resourceMissingType) throws JRException { tableScriptletParam = parametersMap.get(TABLE_SCRIPTLET_NAME + JRScriptlet.SCRIPTLET_PARAMETER_NAME_SUFFIX); }
@Override public void init(Map<String, JRFillParameter> parametersMap, Map<String, JRFillField> fieldsMap, Map<String, JRFillVariable> variablesMap, WhenResourceMissingTypeEnum resourceMissingType, boolean ignoreNPE) throws JRException { // NOP }
@SuppressWarnings("unchecked") public WhenResourceMissingTypeProperty(JRDesignDataset dataset) { // TODO: Replace WhenNoDataType with the right constant super(WhenResourceMissingTypeEnum.class, dataset); this.dataset = dataset; setValue("suppressCustomEditor", Boolean.TRUE); }
@Override public List getTagList() { List tags = new java.util.ArrayList(); tags.add(new Tag(WhenResourceMissingTypeEnum.EMPTY, I18n.getString("DatasetNode.Property.Empty"))); tags.add(new Tag(WhenResourceMissingTypeEnum.ERROR, I18n.getString("DatasetNode.Property.Error"))); tags.add(new Tag(WhenResourceMissingTypeEnum.KEY, I18n.getString("DatasetNode.Property.Key"))); tags.add(new Tag(WhenResourceMissingTypeEnum.NULL, I18n.getString("DatasetNode.Property.Null"))); return tags; }
@Override public WhenResourceMissingTypeEnum getWhenResourceMissingTypeValue() { return mainDataset.getWhenResourceMissingTypeValue(); }
@Override public void setWhenResourceMissingType(WhenResourceMissingTypeEnum whenResourceMissingType) { mainDataset.setWhenResourceMissingType(whenResourceMissingType); }
@Override public WhenResourceMissingTypeEnum getWhenResourceMissingTypeValue() { return whenResourceMissingTypeValue; }
@Override public WhenResourceMissingTypeEnum getWhenResourceMissingTypeValue() { return whenResourceMissingType; }
@Override public void setWhenResourceMissingType(WhenResourceMissingTypeEnum whenResourceMissingType) { this.whenResourceMissingType = whenResourceMissingType; }
protected WhenResourceMissingTypeEnum getWhenResourceMissingType() { return mainDataset.whenResourceMissingType; }
public void init(Map<String, JRFillParameter> parametersMap, Map<String, JRFillVariable> variablesMap, WhenResourceMissingTypeEnum whenResourceMissingType, boolean ignoreNPE) throws JRException { evaluator.init(parametersMap, null, variablesMap, whenResourceMissingType, ignoreNPE); }
void init(Map<String, JRFillParameter> parametersMap, Map<String, JRFillField> fieldsMap, Map<String, JRFillVariable> variablesMap, WhenResourceMissingTypeEnum resourceMissingType) throws JRException;
@Override public WhenResourceMissingTypeEnum getWhenResourceMissingTypeValue() { return tableSubdataset.getWhenResourceMissingTypeValue(); }
@Override public void setWhenResourceMissingType( WhenResourceMissingTypeEnum whenResourceMissingType) { throw new UnsupportedOperationException(); }
/** * Creates the property descriptors. * * @param desc * the desc */ @Override public void createPropertyDescriptors(List<IPropertyDescriptor> desc, Map<String, Object> defaultsMap) { validator = new DatasetNameValidator(); validator.setTargetNode(this); JSSValidatedTextPropertyDescriptor nameD = new JSSValidatedTextPropertyDescriptor(JRDesignDataset.PROPERTY_NAME, Messages.common_name, validator); nameD.setDescription(Messages.MDataset_name_description); desc.add(nameD); JPropertiesPropertyDescriptor propertiesD = new JPropertiesPropertyDescriptor(PROPERTY_MAP, Messages.common_properties); propertiesD.setDescription(Messages.MDataset_properties_description); desc.add(propertiesD); propertiesD.setHelpRefBuilder(new HelpReferenceBuilder( "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#property")); NClassTypePropertyDescriptor classD = new NClassTypePropertyDescriptor(JRDesignDataset.PROPERTY_SCRIPTLET_CLASS, Messages.MDataset_scriplet_class); classD.setDescription(Messages.MDataset_class_description); desc.add(classD); classD.setHelpRefBuilder(new HelpReferenceBuilder( "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#scriptlet")); ResourceBundlePropertyDescriptor resBundleD = new ResourceBundlePropertyDescriptor( JRDesignDataset.PROPERTY_RESOURCE_BUNDLE, Messages.MDataset_resource_bundle); resBundleD.setDescription(Messages.MDataset_resource_bundle_description); desc.add(resBundleD); JRQueryButtonPropertyDescriptor queryD = new JRQueryButtonPropertyDescriptor(JRDesignDataset.PROPERTY_QUERY, Messages.common_query, NullEnum.NULL, Messages.MDataset_Edit_Query_Button_Text); queryD.setDescription(Messages.MDataset_query_description); desc.add(queryD); queryD.setHelpRefBuilder(new HelpReferenceBuilder( "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#queryString")); whenResMissTypeD = new JSSEnumPropertyDescriptor(JRDesignDataset.PROPERTY_WHEN_RESOURCE_MISSING_TYPE, Messages.MDataset_when_resource_missing_type, WhenResourceMissingTypeEnum.class, NullEnum.NOTNULL); whenResMissTypeD.setDescription(Messages.MDataset_when_resource_missing_type_description); desc.add(whenResMissTypeD); JRExpressionPropertyDescriptor filterExpression = new JRExpressionPropertyDescriptor( JRDesignDataset.PROPERTY_FILTER_EXPRESSION, Messages.MDataset_filter_expression); filterExpression.setDescription(Messages.MDataset_filter_expression_description); desc.add(filterExpression); filterExpression.setHelpRefBuilder(new HelpReferenceBuilder( "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#filterExpression")); defaultsMap.put(JRDesignDataset.PROPERTY_RESOURCE_BUNDLE, null); defaultsMap.put(JRDesignDataset.PROPERTY_WHEN_RESOURCE_MISSING_TYPE, EnumHelper.getValue(WhenResourceMissingTypeEnum.NULL, 1, false)); defaultsMap.put(JRDesignDataset.PROPERTY_FILTER_EXPRESSION, null); setHelpPrefix(desc, "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#subDataset"); }
@Override public Object getDefaultValue() { return WhenResourceMissingTypeEnum.NULL; }
@Override public void setPropertyValue(Object val) { dataset.setWhenResourceMissingType((WhenResourceMissingTypeEnum)val); }
/** * Returns the resource missing handling type. * * @return the resource missing handling type */ public WhenResourceMissingTypeEnum getWhenResourceMissingTypeValue();
/** * Sets the resource missing handling type. * @param whenResourceMissingType the resource missing handling type */ public void setWhenResourceMissingType(WhenResourceMissingTypeEnum whenResourceMissingType);
/** * Returns the resource missing handling type. */ public WhenResourceMissingTypeEnum getWhenResourceMissingTypeValue();