protected void writeTextInputComponent(TextInputComponent textInputComponent, ComponentKey componentKey, JRXmlWriter reportWriter) throws IOException { JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper(); String namespaceURI = componentKey.getNamespace(); String schemaLocation = ComponentsEnvironment.getInstance(jasperReportsContext) .getBundle(namespaceURI).getXmlParser().getPublicSchemaLocation(); XmlNamespace componentNamespace = new XmlNamespace(namespaceURI, componentKey.getNamespacePrefix(), schemaLocation); writer.startElement("textInput", componentNamespace); writer.addAttribute("multiLine", textInputComponent.isMultiLine()); reportWriter.writeTextField(textInputComponent.getTextField()); writer.closeElement(); }
/** * */ public static String getVersion(JasperReportsContext jasperReportsContext, JRPart part, JRXmlWriter reportWriter) { String version = null; ComponentKey componentKey = part.getComponentKey(); String versionProperty = PROPERTY_PART_COMPONENTS_PREFIX + componentKey.getName() + AbstractComponentXmlWriter.PROPERTY_COMPONENTS_VERSION_SUFFIX; if (part.getPropertiesMap().containsProperty(versionProperty)) { version = part.getPropertiesMap().getProperty(versionProperty); } else { JRReport report = reportWriter.getReport(); version = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(report, versionProperty); if (version == null) { version = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(report, JRXmlBaseWriter.PROPERTY_REPORT_VERSION); } } return version; }
public FillPart(JRPart part, JRFillObjectFactory fillFactory) { this.reportPart = part; this.expressionEvaluator = fillFactory.getExpressionEvaluator(); reportFiller = (PartReportFiller) fillFactory.getReportFiller();//FIXMEBOOK ComponentKey componentKey = part.getComponentKey(); PartComponent component = part.getComponent(); JasperReportsContext jasperReportsContext = fillFactory.getReportFiller().getJasperReportsContext(); PartComponentsEnvironment partsEnv = PartComponentsEnvironment.getInstance(jasperReportsContext); PartComponentManager componentManager = partsEnv.getManager(componentKey); PartComponentFillFactory componentFactory = componentManager.getComponentFillFactory(jasperReportsContext); //fillFactory.trackDatasetRuns();FIXMEBOOK this.fillComponent = componentFactory.toFillComponent(component, fillFactory); fillComponent.initialize(new Context()); }
@Override public void end(String namespace, String name) throws JRException { Object top = getDigester().peek(); if (!(top instanceof Component)) { throw new JRException( EXCEPTION_MESSAGE_KEY_INVALID_INSTANCE, new Object[]{top.getClass().getName(), Component.class.getName()}); } Component component = (Component) top; JRDesignComponentElement componentElement = (JRDesignComponentElement) getDigester().peek(1); String namespacePrefix = ((JRXmlDigester) getDigester()).getLastNamespacePrefix(); ComponentKey componentKey = new ComponentKey(namespace, namespacePrefix, name); componentElement.setComponentKey(componentKey); componentElement.setComponent(component); }
public void writeComponentElement(JRComponentElement componentElement) throws IOException { ComponentKey componentKey = componentElement.getComponentKey(); ComponentXmlWriter componentXmlWriter = ComponentsEnvironment.getInstance(jasperReportsContext).getManager(componentKey).getComponentXmlWriter(jasperReportsContext); if (componentXmlWriter.isToWrite(componentElement, this)) { writer.startElement(JRXmlConstants.ELEMENT_componentElement, getNamespace()); writeReportElement(componentElement); componentXmlWriter.writeToXml(componentElement, this); writer.closeElement(); } }
@Override public void end(String namespace, String name) throws JRException { Object top = getDigester().peek(); if (!(top instanceof PartComponent)) { throw new JRException( EXCEPTION_MESSAGE_KEY_INVALID_INSTANCE, new Object[]{top.getClass().getName(), PartComponent.class.getName()}); } PartComponent component = (PartComponent) top; JRDesignPart part = (JRDesignPart) getDigester().peek(1); String namespacePrefix = ((JRXmlDigester) getDigester()).getLastNamespacePrefix(); ComponentKey componentKey = new ComponentKey(namespace, namespacePrefix, name); part.setComponentKey(componentKey); part.setComponent(component); }
/** * */ public static String getVersion(JasperReportsContext jasperReportsContext, JRComponentElement componentElement, JRXmlWriter reportWriter) { String version = null; ComponentKey componentKey = componentElement.getComponentKey(); String versionProperty = PROPERTY_COMPONENTS_PREFIX + componentKey.getName() + PROPERTY_COMPONENTS_VERSION_SUFFIX; if (componentElement.getPropertiesMap().containsProperty(versionProperty)) { version = componentElement.getPropertiesMap().getProperty(versionProperty); } else { JRReport report = reportWriter.getReport(); version = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(report, versionProperty); if (version == null) { version = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(report, JRXmlBaseWriter.PROPERTY_REPORT_VERSION); } } return version; }
@Override public JRDesignComponentElement createJRElement(JasperDesign jasperDesign) { JRDesignComponentElement designMap = new JRDesignComponentElement(); StandardMapComponent component = new StandardMapComponent(); JRDesignExpression exp1 = new JRDesignExpression(); exp1.setText(MapDesignConverter.DEFAULT_LATITUDE.toString() + "f"); //$NON-NLS-1$ JRDesignExpression exp2 = new JRDesignExpression(); exp2.setText(MapDesignConverter.DEFAULT_LONGITUDE.toString() + "f"); //$NON-NLS-1$ component.setLatitudeExpression(exp1); component.setLongitudeExpression(exp2); JRDesignExpression exp3 = new JRDesignExpression(); exp3.setText(String.valueOf(MapComponent.DEFAULT_ZOOM)); component.setZoomExpression(exp3); designMap.setComponent(component); designMap.setComponentKey(new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "c", //$NON-NLS-1$ //$NON-NLS-2$ "map")); //$NON-NLS-1$ StandardItemData markerData = safeGetMarkerData(component, null); markerData.setDataset(new JRDesignElementDataset()); DefaultManager.INSTANCE.applyDefault(this.getClass(), designMap); return designMap; }
@Override public JRDesignComponentElement createJRElement(JasperDesign jasperDesign) { JRDesignComponentElement component = new JRDesignComponentElement(); component.setHeight(getDefaultHeight()); component.setWidth(getDefaultWidth()); StandardListComponent componentImpl = new StandardListComponent(); DesignListContents contents = new DesignListContents(); contents.setHeight(100); contents.setWidth(100); componentImpl.setContents(contents); component.setComponent(componentImpl); ComponentKey componentKey = new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "jr", "list"); component.setComponentKey(componentKey); JRDesignDatasetRun datasetRun = new JRDesignDatasetRun(); componentImpl.setDatasetRun(datasetRun); DefaultManager.INSTANCE.applyDefault(this.getClass(), component); return component; }
@Override public JRDesignComponentElement createJRElement(JasperDesign jasperDesign) { JRDesignComponentElement jrcomponent = new JRDesignComponentElement(); jrcomponent.setWidth(getDefaultWidth()); jrcomponent.setHeight(getDefaultHeight()); SpiderChartComponent component = new SpiderChartComponent(); component.setChartSettings(new StandardChartSettings()); component.setDataset(new StandardSpiderDataset()); StandardSpiderPlot spiderPlot = new StandardSpiderPlot(); spiderPlot.setWebFilled(true); component.setPlot(spiderPlot); jrcomponent.setComponent(component); jrcomponent.setComponentKey(new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "sc", "spiderChart")); //$NON-NLS-1$ DefaultManager.INSTANCE.applyDefault(this.getClass(), jrcomponent); return jrcomponent; }
private JRDesignElement spiderChart(DRIDesignChart chart) { SpiderChartComponent jrChart = new SpiderChartComponent(); EvaluationTime evaluationTime = chart.getEvaluationTime(); jrChart.setEvaluationTime(ConstantTransform.evaluationTime(evaluationTime)); if (evaluationTime != null && evaluationTime.equals(EvaluationTime.GROUP) && chart.getEvaluationGroup() != null) { jrChart.setEvaluationGroup(accessor.getGroupTransform().getGroup(chart.getEvaluationGroup()).getName()); } jrChart.setChartSettings(spiderSettings(chart)); StandardSpiderDataset jrDataset = new StandardSpiderDataset(); dataset(chart.getDataset(), jrDataset); jrChart.setDataset(jrDataset); StandardSpiderPlot jrPlot = new StandardSpiderPlot(); jrChart.setPlot(jrPlot); spiderPlot((DRIDesignSpiderPlot) chart.getPlot(), jrPlot); JRDesignComponentElement jrComponent = new JRDesignComponentElement(); jrComponent.setComponent(jrChart); jrComponent.setComponentKey(new ComponentKey(ComponentsExtensionsRegistryFactory.NAMESPACE, "jr", "spiderChart")); return jrComponent; }
@Override public JRComponentElement jasperComponent(JasperTransformAccessor accessor, DRIDesignGeoMap geoMap) { StandardGeoMapComponent jrGeoMap = new StandardGeoMapComponent(); EvaluationTime evaluationTime = geoMap.getEvaluationTime(); jrGeoMap.setEvaluationTime(ConstantTransform.evaluationTime(evaluationTime)); if (evaluationTime != null && evaluationTime.equals(EvaluationTime.GROUP) && geoMap.getEvaluationGroup() != null) { jrGeoMap.setEvaluationGroup(accessor.getGroupTransform().getGroup(geoMap.getEvaluationGroup()).getName()); } jrGeoMap.setShowLegend(geoMap.getShowLegend()); jrGeoMap.setDataMode(geoMap.getDataMode()); jrGeoMap.setRegionExpression(accessor.getExpressionTransform().getExpression(geoMap.getRegionExpression())); jrGeoMap.setValueLabelExpression(accessor.getExpressionTransform().getExpression(geoMap.getValueLabelExpression())); jrGeoMap.setColors(geoMap.getColors()); StandardGeoMapDataset jrDataset = new StandardGeoMapDataset(); dataset(accessor, geoMap.getDataset(), jrDataset); jrGeoMap.setDataset(jrDataset); JRDesignComponentElement jrComponent = new JRDesignComponentElement(); jrComponent.setComponent(jrGeoMap); jrComponent.setComponentKey(new ComponentKey(GoogleChartsExtensionsRegistryFactory.NAMESPACE, "jr", GeoMapPrintElement.GEOMAP_ELEMENT_NAME)); return jrComponent; }
@Override public boolean isToWrite(JRComponentElement componentElement, JRXmlWriter reportWriter) { ComponentKey componentKey = componentElement.getComponentKey(); if (ComponentsExtensionsRegistryFactory.NAMESPACE.equals(componentKey .getNamespace())) { if (ComponentsExtensionsRegistryFactory.WMS_MAP_COMPONENT_NAME .equals(componentKey.getName())) { return isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_5_0_1); } } // XXX: Defaults to true in jr ComponentsExtensionRegistryFactory??? return false; }
protected String getVersion(JRComponentElement componentElement, JRXmlWriter reportWriter) { String version = null; ComponentKey componentKey = componentElement.getComponentKey(); String versionProperty = PROPERTY_COMPONENTS_PREFIX + componentKey.getName() + PROPERTY_COMPONENTS_VERSION_SUFFIX; if (componentElement.getPropertiesMap().containsProperty(versionProperty)) { version = componentElement.getPropertiesMap() .getProperty(versionProperty); } else { JRReport report = reportWriter.getReport(); version = JRPropertiesUtil.getInstance(jasperReportsContext) .getProperty(report, versionProperty); if (version == null) { version = JRPropertiesUtil.getInstance(jasperReportsContext) .getProperty(report, JRXmlBaseWriter.PROPERTY_REPORT_VERSION); } } return version; }
@Override public JRDesignElement createReportElement(final JasperDesign jd) { JRDesignComponentElement component = new JRDesignComponentElement(); StandardWmsMapComponent mapComponent = new StandardWmsMapComponent(); mapComponent.setWmsServiceUrl("http://"); mapComponent.setWmsVersion("1.1.1"); mapComponent.setSrs(""); mapComponent.setTransparent(Boolean.FALSE); mapComponent.setBBoxExpression(Misc.createExpression(null, "\"0.0,0.0,0.0,0.0\"")); mapComponent.setLayersExpression(Misc.createExpression(null, "\"layer1,layer2\"")); mapComponent.setStylesExpression(Misc.createExpression(null, "\"style1,style2\"")); mapComponent.setUrlParametersExpression(Misc.createExpression(null, "\"\"")); component.setComponent(mapComponent); ComponentKey key = new ComponentKey("http://sourcepole.com/jasperreports/components", "wmp", "wmsmap"); component.setComponentKey(key); component.setWidth(200); component.setHeight(200); return component; }
@Override public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException { Component component = componentElement.getComponent(); if (component instanceof TextInputComponent) { TextInputComponent textInputComponent = (TextInputComponent) component; ComponentKey componentKey = componentElement.getComponentKey(); writeTextInputComponent(textInputComponent, componentKey, reportWriter); } }
public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException { Component component = componentElement.getComponent(); PieChartComponent chart = (PieChartComponent) component; JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper(); ComponentKey componentKey = componentElement.getComponentKey(); String namespaceURI = componentKey.getNamespace(); String schemaLocation = ComponentsEnvironment.getInstance(jasperReportsContext) .getBundle(namespaceURI).getXmlParser().getPublicSchemaLocation(); XmlNamespace namespace = new XmlNamespace(namespaceURI, componentKey.getNamespacePrefix(), schemaLocation); writer.startElement("pieChart", namespace); writer.addAttribute("evaluationTime", chart.getEvaluationTime(), EvaluationTimeEnum.NOW); if (chart.getEvaluationTime() == EvaluationTimeEnum.GROUP) { writer.addEncodedAttribute("evaluationGroup", chart.getEvaluationGroup()); } PieDataset dataset = chart.getDataset(); writer.startElement("pieDataset"); reportWriter.writeElementDataset(dataset); writer.writeExpression("keyExpression", dataset.getKeyExpression()); writer.writeExpression("valueExpression", dataset.getValueExpression()); writer.closeElement();//pieDataset writer.writeExpression("titleExpression", chart.getTitleExpression()); writer.closeElement();//pieChart }
protected void writeHtmlComponent(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException { Component component = componentElement.getComponent(); HtmlComponent htmlComponent = (HtmlComponent) component; ComponentKey componentKey = componentElement.getComponentKey(); XmlNamespace namespace = new XmlNamespace( HtmlComponentExtensionsRegistryFactory.NAMESPACE, componentKey.getNamespacePrefix(), HtmlComponentExtensionsRegistryFactory.XSD_LOCATION); JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper(); writer.startElement("html", namespace); writer.addAttribute(HtmlComponent.PROPERTY_SCALE_TYPE, htmlComponent.getScaleType()); writer.addAttribute(HtmlComponent.PROPERTY_HORIZONTAL_ALIGN, htmlComponent.getHorizontalImageAlign()); writer.addAttribute(HtmlComponent.PROPERTY_VERTICAL_ALIGN, htmlComponent.getVerticalImageAlign()); writeExpression(HtmlComponent.PROPERTY_HTMLCONTENT_EXPRESSION, htmlComponent.getHtmlContentExpression(), false, componentElement, reportWriter); if (htmlComponent.getEvaluationTime() != EvaluationTimeEnum.NOW) { writer.addAttribute(HtmlComponent.PROPERTY_EVALUATION_TIME, htmlComponent.getEvaluationTime()); } writer.addAttribute(HtmlComponent.PROPERTY_EVALUATION_GROUP, htmlComponent.getEvaluationGroup()); writer.addAttribute(HtmlComponent.PROPERTY_CLIP_ON_OVERFLOW, htmlComponent.getClipOnOverflow()); writer.closeElement(); }
protected void writeSubreport(JRPart part, JRXmlWriter reportWriter) throws IOException { SubreportPartComponent subreport = (SubreportPartComponent) part.getComponent(); ComponentKey componentKey = part.getComponentKey(); JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper(); XmlNamespace namespace = new XmlNamespace( PartComponentsExtensionsRegistryFactory.NAMESPACE, componentKey.getNamespacePrefix(), PartComponentsExtensionsRegistryFactory.XSD_LOCATION); writer.startElement(PartComponentsExtensionsRegistryFactory.SUBREPORT_PART_COMPONENT_NAME, namespace); writer.addAttribute("usingCache", subreport.getUsingCache()); writer.writeExpression(JRXmlConstants.ELEMENT_parametersMapExpression, JRXmlWriter.JASPERREPORTS_NAMESPACE, subreport.getParametersMapExpression()); JRSubreportParameter[] parameters = subreport.getParameters(); if (parameters != null && parameters.length > 0) { for(int i = 0; i < parameters.length; i++) { reportWriter.writeSubreportParameter(parameters[i], JRXmlWriter.JASPERREPORTS_NAMESPACE); } } JRSubreportReturnValue[] returnValues = subreport.getReturnValues(); if (returnValues != null && returnValues.length > 0) { for(int i = 0; i < returnValues.length; i++) { reportWriter.writeSubreportReturnValue(returnValues[i], JRXmlWriter.JASPERREPORTS_NAMESPACE); } } writer.writeExpression(JRXmlConstants.ELEMENT_subreportExpression, JRXmlWriter.JASPERREPORTS_NAMESPACE, subreport.getExpression()); writer.closeElement(); }
@Override public boolean isToWrite(JRPart part, JRXmlWriter reportWriter) { ComponentKey componentKey = part.getComponentKey(); if (ComponentsExtensionsRegistryFactory.NAMESPACE.equals(componentKey.getNamespace())) { if(PartComponentsExtensionsRegistryFactory.SUBREPORT_PART_COMPONENT_NAME.equals(componentKey.getName())) { return isNewerVersionOrEqual(part, reportWriter, JRConstants.VERSION_6_0_0); } } return true; }
@Override public JRPrintElement convert(ReportConverter reportConverter, JRElement element) { JRComponentElement componentElement = (JRComponentElement) element; JRPrintElement converted = null; ComponentKey componentKey = componentElement.getComponentKey(); if (componentKey != null) { ComponentManager manager = reportConverter.getComponentsEnvironment().getManager(componentKey); if (manager != null) { ComponentDesignConverter converter = manager.getDesignConverter(reportConverter.getJasperReportsContext()); if (converter != null) { // convert using the component converter converted = converter.convert(reportConverter, componentElement); } } } if (converted == null) { // fallback to the icon converter converted = ICON_CONVERTER.convert(reportConverter, element); } return converted; }
/** * */ private void writePart(JRPart part) throws IOException { ComponentKey componentKey = part.getComponentKey(); PartComponentXmlWriter componentXmlWriter = PartComponentsEnvironment.getInstance(jasperReportsContext).getManager(componentKey).getComponentXmlWriter(jasperReportsContext); if (componentXmlWriter.isToWrite(part, this)) { writer.startElement(JRXmlConstants.ELEMENT_part, getNamespace()); PartEvaluationTime evaluationTime = part.getEvaluationTime(); if (evaluationTime != null) { writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, evaluationTime.getEvaluationTimeType()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup, evaluationTime.getEvaluationGroup()); } if (!isExcludeUuids()) { writer.addAttribute(JRXmlConstants.ATTRIBUTE_uuid, part.getUUID().toString()); } writeProperties(part); writeExpression(JRXmlConstants.ELEMENT_printWhenExpression, part.getPrintWhenExpression(), false); writeExpression(JRXmlConstants.ELEMENT_partNameExpression, part.getPartNameExpression(), false); componentXmlWriter.writeToXml(part, this); writer.closeElement(); } }
/** * */ private void collect(JRPart part) { if (part != null) { addExpression(part.getPrintWhenExpression()); addExpression(part.getPartNameExpression()); ComponentKey componentKey = part.getComponentKey(); PartComponentManager manager = PartComponentsEnvironment.getInstance(jasperReportsContext).getManager(componentKey); PartComponent component = part.getComponent(); manager.getComponentCompiler(jasperReportsContext).collectExpressions(component, this); } }
protected void verifyComponentElement(JRComponentElement element) { verifyReportElement(element); ComponentKey componentKey = element.getComponentKey(); if (componentKey == null) { addBrokenRule("No component key set for component element", element); } Component component = element.getComponent(); if (component == null) { addBrokenRule("No component set for component element", element); } if (componentKey != null && component != null) { ComponentCompiler compiler = ComponentsEnvironment.getInstance(jasperReportsContext).getManager(componentKey).getComponentCompiler(jasperReportsContext); pushCurrentComponentElement(element); try { compiler.verify(component, this); } finally { popCurrentComponentElement(); } } }
/** * Sets the component type key that corresponds to the component instance. * * @param componentKey the component type key * @see #getComponentKey() */ public void setComponentKey(ComponentKey componentKey) { Object old = this.componentKey; this.componentKey = componentKey; getEventSupport().firePropertyChange(PROPERTY_COMPONENT_KEY, old, this.componentKey); }
public JRFillComponentElement(JRBaseFiller filler, JRComponentElement element, JRFillObjectFactory factory) { super(filler, element, factory); ComponentKey componentKey = element.getComponentKey(); ComponentManager manager = ComponentsEnvironment.getInstance(filler.getJasperReportsContext()).getManager(componentKey); factory.trackDatasetRuns(); fillComponent = manager.getComponentFillFactory(filler.getJasperReportsContext()).toFillComponent(element.getComponent(), factory); fillComponent.initialize(this); this.componentDatasetRuns = factory.getTrackedDatasetRuns(); }
public JRFillComponentElement(JRFillComponentElement element, JRFillCloneFactory factory) { super(element, factory); ComponentKey componentKey = element.getComponentKey(); ComponentManager manager = ComponentsEnvironment.getInstance(filler.getJasperReportsContext()).getManager(componentKey); fillComponent = manager.getComponentFillFactory(filler.getJasperReportsContext()).cloneFillComponent(element.fillComponent, factory); fillComponent.initialize(this); }
protected void writeList(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException { ListComponent list = (ListComponent) componentElement.getComponent(); ComponentKey componentKey = componentElement.getComponentKey(); JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper(); XmlNamespace namespace = new XmlNamespace( ComponentsExtensionsRegistryFactory.NAMESPACE, componentKey.getNamespacePrefix(), ComponentsExtensionsRegistryFactory.XSD_LOCATION); writer.startElement("list", namespace); if(isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_3_6_1)) { writer.addAttribute("printOrder", list.getPrintOrderValue()); } writer.addAttribute("ignoreWidth", list.getIgnoreWidth()); reportWriter.writeDatasetRun(list.getDatasetRun()); ListContents contents = list.getContents(); writer.startElement("listContents"); writer.addAttribute("height", contents.getHeight()); writer.addAttribute("width", contents.getWidth()); reportWriter.writeChildElements(contents); writer.closeElement(); writer.closeElement(); }
protected void writeBarbecue(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException { Component component = componentElement.getComponent(); BarbecueComponent barcode = (BarbecueComponent) component; JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper(); ComponentKey componentKey = componentElement.getComponentKey(); XmlNamespace namespace = new XmlNamespace( ComponentsExtensionsRegistryFactory.NAMESPACE, componentKey.getNamespacePrefix(), ComponentsExtensionsRegistryFactory.XSD_LOCATION); writer.startElement("barbecue", namespace); writer.addAttribute("type", barcode.getType()); writer.addAttribute("drawText", barcode.isDrawText()); writer.addAttribute("checksumRequired", barcode.isChecksumRequired()); writer.addAttribute("barWidth", barcode.getBarWidth()); writer.addAttribute("barHeight", barcode.getBarHeight()); if (isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_4_0_0)) { writer.addAttribute("rotation", barcode.getOwnRotation()); } if (barcode.getEvaluationTimeValue() != EvaluationTimeEnum.NOW) { writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, barcode.getEvaluationTimeValue()); } writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup, barcode.getEvaluationGroup()); writeExpression("codeExpression", barcode.getCodeExpression(), false, componentElement, reportWriter); writeExpression("applicationIdentifierExpression", barcode.getApplicationIdentifierExpression(), false, componentElement, reportWriter); writer.closeElement(); }
@Override public boolean isToWrite(JRComponentElement componentElement, JRXmlWriter reportWriter) { ComponentKey componentKey = componentElement.getComponentKey(); if (ComponentsExtensionsRegistryFactory.NAMESPACE.equals(componentKey.getNamespace())) { if(ComponentsExtensionsRegistryFactory.SORT_COMPONENT_NAME.equals(componentKey.getName()) || ComponentsExtensionsRegistryFactory.MAP_COMPONENT_NAME.equals(componentKey.getName())) { return isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_4_1_1); } else if(ComponentsExtensionsRegistryFactory.SPIDERCHART_COMPONENT_NAME.equals(componentKey.getName())) { return isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_3_7_4); } else if(ComponentsExtensionsRegistryFactory.TABLE_COMPONENT_NAME.equals(componentKey.getName())) { return isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_3_7_2); } else if(ComponentsExtensionsRegistryFactory.LIST_COMPONENT_NAME.equals(componentKey.getName())) { return isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_3_5_1); } else if(ComponentsExtensionsRegistryFactory.BARBECUE_COMPONENT_NAME.equals(componentKey.getName()) || isBarcode4jName(componentKey.getName())) { return isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_3_5_2); } } return true; }
@Override public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException { Component component = componentElement.getComponent(); SpiderChartComponent spiderChartComponent = (SpiderChartComponent) component; JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper(); ComponentKey componentKey = componentElement.getComponentKey(); String namespaceURI = componentKey.getNamespace(); String schemaLocation = ComponentsEnvironment.getInstance(jasperReportsContext) .getBundle(namespaceURI).getXmlParser().getPublicSchemaLocation(); XmlNamespace componentNamespace = new XmlNamespace(namespaceURI, componentKey.getNamespacePrefix(), schemaLocation); writer.startElement(ELEMENT_spiderChart, componentNamespace); writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, spiderChartComponent.getEvaluationTime(), EvaluationTimeEnum.NOW); if (spiderChartComponent.getEvaluationTime() == EvaluationTimeEnum.GROUP) { writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup, spiderChartComponent.getEvaluationGroup()); } ChartSettings chartSettings = spiderChartComponent.getChartSettings(); writeChart(chartSettings, writer, reportWriter, componentNamespace); SpiderDataset dataset = (SpiderDataset)spiderChartComponent.getDataset(); writeSpiderDataSet(dataset, writer, reportWriter, componentNamespace); SpiderPlot spiderPlot = (SpiderPlot)spiderChartComponent.getPlot(); writeSpiderPlot(spiderPlot, chartSettings, writer, componentNamespace); writer.closeElement();//spiderChart }
@Override public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException { Component component = componentElement.getComponent(); if (component instanceof IconLabelComponent) { IconLabelComponent iconLabelComponent = (IconLabelComponent) component; ComponentKey componentKey = componentElement.getComponentKey(); writeIconLabelComponent(iconLabelComponent, componentKey, reportWriter); } }
protected void writeIconLabelComponent(IconLabelComponent iconLabelComponent, ComponentKey componentKey, JRXmlWriter reportWriter) throws IOException { JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper(); String namespaceURI = componentKey.getNamespace(); String schemaLocation = ComponentsEnvironment.getInstance(jasperReportsContext) .getBundle(namespaceURI).getXmlParser().getPublicSchemaLocation(); XmlNamespace componentNamespace = new XmlNamespace(namespaceURI, componentKey.getNamespacePrefix(), schemaLocation); writer.startElement("iconLabel", componentNamespace); writer.addAttribute(IconLabelComponent.PROPERTY_ICON_POSITION, iconLabelComponent.getIconPosition()); writer.addAttribute(IconLabelComponent.PROPERTY_LABEL_FILL, iconLabelComponent.getLabelFill()); writer.addAttribute(IconLabelComponent.PROPERTY_HORIZONTAL_ALIGNMENT, iconLabelComponent.getOwnHorizontalImageAlign()); writer.addAttribute(IconLabelComponent.PROPERTY_VERTICAL_ALIGNMENT, iconLabelComponent.getOwnVerticalImageAlign()); reportWriter.writeBox(iconLabelComponent.getLineBox(), JRXmlWriter.JASPERREPORTS_NAMESPACE); writer.startElement("label", componentNamespace); reportWriter.writeTextField(iconLabelComponent.getLabelTextField()); writer.closeElement(); writer.startElement("icon", componentNamespace); reportWriter.writeTextField(iconLabelComponent.getIconTextField()); writer.closeElement(); writer.closeElement(); }
@Override public JRDesignElement createJRElement(JasperDesign jasperDesign) { JRDesignComponentElement el = new JRDesignComponentElement(); HtmlComponent component = new HtmlComponent(); JRDesignExpression exp = new JRDesignExpression(); exp.setValueClassName("java.lang.String"); //$NON-NLS-1$ exp.setText("\"<p style='background-color:yellow;'>HTML paragraph</p>\""); //$NON-NLS-1$ component.setHtmlContentExpression(exp); el.setComponent(component); el.setComponentKey(new ComponentKey( "http://jasperreports.sourceforge.net/htmlcomponent", "hc", "html")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return el; }
@Override public JRDesignComponentElement createJRElement(JasperDesign jasperDesign) { JRDesignComponentElement el = new JRDesignComponentElement(); CVDesignComponent cvComp = new CVDesignComponent(); el.setComponent(cvComp); el.setComponentKey(new ComponentKey( "http://www.jaspersoft.com/cvcomponent", "cvc", "customvisualization")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return el; }
@Override public JRDesignComponentElement createJRElement(JasperDesign jasperDesign) { JRDesignComponentElement el = new JRDesignComponentElement(); POSTNETComponent component = new POSTNETComponent(); JRDesignExpression exp = new JRDesignExpression(); exp.setText("\"123456789\""); //$NON-NLS-1$ component.setCodeExpression(exp); el.setComponent(component); el.setComponentKey(new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "jr", "POSTNET")); //$NON-NLS-1$ DefaultManager.INSTANCE.applyDefault(this.getClass(), el); return el; }
@Override public JRDesignComponentElement createJRElement(JasperDesign jasperDesign) { JRDesignComponentElement el = new JRDesignComponentElement(); UPCAComponent component = new UPCAComponent(); JRDesignExpression exp = new JRDesignExpression(); exp.setText("\"12345678901\""); //$NON-NLS-1$ component.setCodeExpression(exp); el.setComponent(component); el.setComponentKey(new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "jr", "UPCA")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ DefaultManager.INSTANCE.applyDefault(this.getClass(), el); return el; }
@Override public JRDesignComponentElement createJRElement(JasperDesign jasperDesign) { JRDesignComponentElement el = new JRDesignComponentElement(); PDF417Component component = new PDF417Component(); JRDesignExpression exp = new JRDesignExpression(); exp.setText("\"123456789\""); //$NON-NLS-1$ component.setCodeExpression(exp); el.setComponent(component); el.setComponentKey(new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "jr", "PDF417")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ DefaultManager.INSTANCE.applyDefault(this.getClass(), el); return el; }
@Override public JRDesignComponentElement createJRElement(JasperDesign jasperDesign) { JRDesignComponentElement el = new JRDesignComponentElement(); DataMatrixComponent component = new DataMatrixComponent(); JRDesignExpression exp = new JRDesignExpression(); exp.setText("\"123456789\""); //$NON-NLS-1$ component.setCodeExpression(exp); el.setComponent(component); el.setComponentKey(new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "jr", "DataMatrix")); //$NON-NLS-1$ DefaultManager.INSTANCE.applyDefault(this.getClass(), el); return el; }