@SuppressWarnings("deprecation") private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (linkType == null) { linkType = JRHyperlinkHelper.getLinkType(HyperlinkTypeEnum.getByValue(hyperlinkType)); } if (linkTarget == null) { linkTarget = JRHyperlinkHelper.getLinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget)); } if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2) { evaluationTimeValue = EvaluationTimeEnum.getByValue(evaluationTime); } }
/** * Returns the built-in hyperlink target, or {@link HyperlinkTargetEnum#CUSTOM HyperlinkTargetEnum.CUSTOM} * if the target name is not a built-in one. * * @param linkTarget the link target type * @return the hyperlink target */ public static HyperlinkTargetEnum getHyperlinkTargetValue(String linkTarget) { HyperlinkTargetEnum target; if (linkTarget == null) { target = HyperlinkTargetEnum.SELF; } else { HyperlinkTargetEnum builtinTarget = HyperlinkTargetEnum.getByName(linkTarget); if (builtinTarget == null) { target = HyperlinkTargetEnum.CUSTOM; } else { target = builtinTarget; } } return target; }
private void jComboBoxLinkTargetActionPerformed1(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxLinkTargetActionPerformed1 if (this.isInit()) return; Object target = jComboBoxLinkTarget.getSelectedItem(); if (target != null && target instanceof Tag) { setHyperlinkAttribute("LinkTarget",String.class, ((HyperlinkTargetEnum) ((Tag)target).getValue() ).getName() ); } else if (target != null) { //setHyperlinkAttribute("HyperlinkTarget", Byte.TYPE, JRHyperlink.HYPERLINK_TARGET_CUSTOM); setHyperlinkAttribute("LinkTarget", String.class, "" + target); } else { setHyperlinkAttribute("LinkTarget", String.class, HyperlinkTargetEnum.SELF.getName()); } fireHyperlinkChanged(); }
@Override public void test() { super.test(); numberOfPagesTest(1); JRPrintText textField = (JRPrintText) getElementAt("title.textField1", 0); Assert.assertEquals("hyperlink reference", "reference", textField.getHyperlinkReference()); Assert.assertEquals("hyperlink tooltip", "tooltip", textField.getHyperlinkTooltip()); Assert.assertEquals("hyperlink anchor", "anchor", textField.getHyperlinkAnchor()); Assert.assertEquals("hyperlink anchorName", "anchorName", textField.getAnchorName()); Assert.assertEquals("hyperlink bookmark level", 1, textField.getBookmarkLevel()); Assert.assertEquals("hyperlink page", new Integer(1), textField.getHyperlinkPage()); Assert.assertEquals("hyperlink type reference", HyperlinkTypeEnum.LOCAL_ANCHOR, textField.getHyperlinkTypeValue()); Assert.assertEquals("hyperlink type reference", HyperlinkTypeEnum.LOCAL_ANCHOR.getName(), textField.getLinkType()); Assert.assertEquals("hyperlink target", HyperlinkTargetEnum.TOP, textField.getHyperlinkTargetValue()); Assert.assertEquals("hyperlink target", HyperlinkTargetEnum.TOP.getName(), textField.getLinkTarget()); textField = (JRPrintText) getElementAt("title.textField2", 0); Assert.assertEquals("hyperlink type reference", HyperlinkTypeEnum.CUSTOM, textField.getHyperlinkTypeValue()); Assert.assertEquals("hyperlink type reference", "customType", textField.getLinkType()); Assert.assertEquals("hyperlink target", HyperlinkTargetEnum.CUSTOM, textField.getHyperlinkTargetValue()); Assert.assertEquals("hyperlink target", "customTarget", textField.getLinkTarget()); }
@SuppressWarnings("deprecation") private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (linkType == null) { linkType = JRHyperlinkHelper.getLinkType(HyperlinkTypeEnum.getByValue(hyperlinkType)); } if (linkTarget == null) { linkTarget = JRHyperlinkHelper.getLinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget)); } if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2) { evaluationTimeValue = EvaluationTimeEnum.getByValue(evaluationTime); if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_1_3) { legendPositionValue = EdgeEnum.getByValue(legendPosition); titlePositionValue = EdgeEnum.getByValue(titlePosition); showLegend = Boolean.valueOf(isShowLegend); } else { legendPositionValue = EdgeEnum.getByValue(legendPositionByte); titlePositionValue = EdgeEnum.getByValue(titlePositionByte); legendPositionByte = null; titlePositionByte = null; } } }
@SuppressWarnings("deprecation") private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (linkTarget == null) { linkTarget = JRHyperlinkHelper.getLinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget)); } }
@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) { horizontalAlignmentValue = net.sf.jasperreports.engine.type.HorizontalAlignEnum.getByValue(horizontalAlignment); verticalAlignmentValue = net.sf.jasperreports.engine.type.VerticalAlignEnum.getByValue(verticalAlignment); scaleImageValue = ScaleImageEnum.getByValue(scaleImage); onErrorTypeValue = OnErrorTypeEnum.getByValue(onErrorType); evaluationTimeValue = EvaluationTimeEnum.getByValue(evaluationTime); horizontalAlignment = null; verticalAlignment = null; scaleImage = null; } if (linkType == null) { linkType = JRHyperlinkHelper.getLinkType(HyperlinkTypeEnum.getByValue(hyperlinkType)); } if (linkTarget == null) { linkTarget = JRHyperlinkHelper.getLinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget)); } if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_6_0_2) { horizontalImageAlign = net.sf.jasperreports.engine.type.HorizontalAlignEnum.getHorizontalImageAlignEnum(horizontalAlignmentValue); verticalImageAlign = net.sf.jasperreports.engine.type.VerticalAlignEnum.getVerticalImageAlignEnum(verticalAlignmentValue); horizontalAlignmentValue = null; verticalAlignmentValue = null; } }
/** * */ public void writeImage(JRImage image) throws IOException { writer.startElement(JRXmlConstants.ELEMENT_image, getNamespace()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_scaleImage, image.getOwnScaleImageValue()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_hAlign, image.getOwnHorizontalImageAlign()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_vAlign, image.getOwnVerticalImageAlign()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_isUsingCache, image.getUsingCache()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_isLazy, image.isLazy(), false); writer.addAttribute(JRXmlConstants.ATTRIBUTE_onErrorType, image.getOnErrorTypeValue(), OnErrorTypeEnum.ERROR); writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, image.getEvaluationTimeValue(), EvaluationTimeEnum.NOW); if (image.getEvaluationGroup() != null) { writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup, image.getEvaluationGroup().getName()); } writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkType, image.getLinkType(), HyperlinkTypeEnum.NONE.getName()); writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkTarget, image.getLinkTarget(), HyperlinkTargetEnum.SELF.getName()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_bookmarkLevel, image.getBookmarkLevel(), JRAnchor.NO_BOOKMARK); writeReportElement(image); writeBox(image.getLineBox()); writeGraphicElement(image); //FIXME class is mandatory in verifier writeExpression(JRXmlConstants.ELEMENT_imageExpression, image.getExpression(), true); writeExpression(JRXmlConstants.ELEMENT_anchorNameExpression, image.getAnchorNameExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkReferenceExpression, image.getHyperlinkReferenceExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkWhenExpression, image.getHyperlinkWhenExpression(), false);//FIXMENOW can we reuse method for writing hyperlink? writeExpression(JRXmlConstants.ELEMENT_hyperlinkAnchorExpression, image.getHyperlinkAnchorExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkPageExpression, image.getHyperlinkPageExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkTooltipExpression, image.getHyperlinkTooltipExpression(), false); writeHyperlinkParameters(image.getHyperlinkParameters()); writer.closeElement(); }
/** * */ public void writeTextField(JRTextField textField) throws IOException { writer.startElement(JRXmlConstants.ELEMENT_textField, getNamespace()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_isStretchWithOverflow, textField.isStretchWithOverflow(), false); writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, textField.getEvaluationTimeValue(), EvaluationTimeEnum.NOW); if (textField.getEvaluationGroup() != null) { writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup, textField.getEvaluationGroup().getName()); } writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_pattern, textField.getOwnPattern()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_isBlankWhenNull, textField.isOwnBlankWhenNull()); writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkType, textField.getLinkType(), HyperlinkTypeEnum.NONE.getName()); writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkTarget, textField.getLinkTarget(), HyperlinkTargetEnum.SELF.getName()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_bookmarkLevel, textField.getBookmarkLevel(), JRAnchor.NO_BOOKMARK); writeReportElement(textField); writeBox(textField.getLineBox()); writeTextElement(textField); writeExpression(JRXmlConstants.ELEMENT_textFieldExpression, textField.getExpression(), true); if(isNewerVersionOrEqual(JRConstants.VERSION_4_1_1)) { writer.writeExpression(JRXmlConstants.ELEMENT_patternExpression, textField.getPatternExpression()); } writeExpression(JRXmlConstants.ELEMENT_anchorNameExpression, textField.getAnchorNameExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkReferenceExpression, textField.getHyperlinkReferenceExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkWhenExpression, textField.getHyperlinkWhenExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkAnchorExpression, textField.getHyperlinkAnchorExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkPageExpression, textField.getHyperlinkPageExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkTooltipExpression, textField.getHyperlinkTooltipExpression(), false); writeHyperlinkParameters(textField.getHyperlinkParameters()); writer.closeElement(); }
public void writeHyperlink(String tagName, XmlNamespace namespace, JRHyperlink hyperlink) throws IOException { if (hyperlink != null) { writer.startElement(tagName, namespace); writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkType, hyperlink.getLinkType(), HyperlinkTypeEnum.NONE.getName()); writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkTarget, hyperlink.getLinkTarget(), HyperlinkTargetEnum.SELF.getName()); writeExpression(JRXmlConstants.ELEMENT_hyperlinkReferenceExpression, JASPERREPORTS_NAMESPACE, hyperlink.getHyperlinkReferenceExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkWhenExpression, JASPERREPORTS_NAMESPACE, hyperlink.getHyperlinkWhenExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkAnchorExpression, JASPERREPORTS_NAMESPACE, hyperlink.getHyperlinkAnchorExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkPageExpression, JASPERREPORTS_NAMESPACE, hyperlink.getHyperlinkPageExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkTooltipExpression, JASPERREPORTS_NAMESPACE, hyperlink.getHyperlinkTooltipExpression(), false); writeHyperlinkParameters(hyperlink.getHyperlinkParameters()); if(isNewerVersionOrEqual(JRConstants.VERSION_3_5_1)) { writer.closeElement(true); } else { writer.closeElement(); } } }
/** * Returns the link target associated with a built-in target. * * @param hyperlinkTarget the built-in target type * @return the String link target */ public static String getLinkTarget(HyperlinkTargetEnum hyperlinkTarget) { String target; switch (hyperlinkTarget) { case NONE: case SELF: target = null; break; case BLANK: target = HyperlinkTargetEnum.BLANK.getName(); break; case PARENT: target = HyperlinkTargetEnum.PARENT.getName(); break; case TOP: target = HyperlinkTargetEnum.TOP.getName(); break; case CUSTOM: throw new JRRuntimeException( EXCEPTION_MESSAGE_KEY_TARGET_BYTE_CONSTANT_USED, (Object[])null); default: throw new JRRuntimeException( EXCEPTION_MESSAGE_KEY_UNKNOWN_HYPERLINK_TARGET, new Object[]{hyperlinkTarget}); } return target; }
@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) { horizontalAlignmentValue = net.sf.jasperreports.engine.type.HorizontalAlignEnum.getByValue(horizontalAlignment); verticalAlignmentValue = net.sf.jasperreports.engine.type.VerticalAlignEnum.getByValue(verticalAlignment); scaleImageValue = ScaleImageEnum.getByValue(scaleImage); onErrorTypeValue = OnErrorTypeEnum.getByValue(onErrorType); horizontalAlignment = null; verticalAlignment = null; scaleImage = null; } if (linkType == null) { linkType = JRHyperlinkHelper.getLinkType(HyperlinkTypeEnum.getByValue(hyperlinkType)); } if (linkTarget == null) { linkTarget = JRHyperlinkHelper.getLinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget)); } if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_6_0_2) { horizontalImageAlign = net.sf.jasperreports.engine.type.HorizontalAlignEnum.getHorizontalImageAlignEnum(horizontalAlignmentValue); verticalImageAlign = net.sf.jasperreports.engine.type.VerticalAlignEnum.getVerticalImageAlignEnum(verticalAlignmentValue); horizontalAlignmentValue = null; verticalAlignmentValue = null; } }
@Override public HyperlinkTargetEnum getHyperlinkTargetValue() { return JRHyperlinkHelper.getHyperlinkTargetValue(getLinkTarget()); }
@Override public void setHyperlinkTarget(HyperlinkTargetEnum hyperlinkTarget) { setLinkTarget(JRHyperlinkHelper.getLinkTarget(hyperlinkTarget)); }
@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) { horizontalAlignmentValue = net.sf.jasperreports.engine.type.HorizontalAlignEnum.getByValue(horizontalAlignment); verticalAlignmentValue = net.sf.jasperreports.engine.type.VerticalAlignEnum.getByValue(verticalAlignment); rotationValue = RotationEnum.getByValue(rotation); runDirectionValue = RunDirectionEnum.getByValue(runDirection); lineSpacingValue = LineSpacingEnum.getByValue(lineSpacing); horizontalAlignment = null; verticalAlignment = null; rotation = null; lineSpacing = null; } if (isStyledText != null) { markup = isStyledText.booleanValue() ? JRCommonText.MARKUP_STYLED_TEXT : JRCommonText.MARKUP_NONE; isStyledText = null; } if (linkType == null) { linkType = JRHyperlinkHelper.getLinkType(HyperlinkTypeEnum.getByValue(hyperlinkType)); } if (linkTarget == null) { linkTarget = JRHyperlinkHelper.getLinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget)); } if (paragraph == null) { paragraph = new JRBaseParagraph(this); paragraph.setLineSpacing(lineSpacingValue); lineSpacingValue = null; } if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_5_5_2) { fontsize = fontSize == null ? null : fontSize.floatValue(); fontSize = null; } if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_6_0_2) { horizontalTextAlign = net.sf.jasperreports.engine.type.HorizontalAlignEnum.getHorizontalTextAlignEnum(horizontalAlignmentValue); verticalTextAlign = net.sf.jasperreports.engine.type.VerticalAlignEnum.getVerticalTextAlignEnum(verticalAlignmentValue); horizontalAlignmentValue = null; verticalAlignmentValue = null; } }
@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) { horizontalAlignmentValue = net.sf.jasperreports.engine.type.HorizontalAlignEnum.getByValue(horizontalAlignment); verticalAlignmentValue = net.sf.jasperreports.engine.type.VerticalAlignEnum.getByValue(verticalAlignment); scaleImageValue = ScaleImageEnum.getByValue(scaleImage); onErrorTypeValue = OnErrorTypeEnum.getByValue(onErrorType); horizontalAlignment = null; verticalAlignment = null; scaleImage = null; } if (linkType == null) { linkType = JRHyperlinkHelper.getLinkType(HyperlinkTypeEnum.getByValue(hyperlinkType)); } if (linkTarget == null) { linkTarget = JRHyperlinkHelper.getLinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget)); } if (renderer != null && renderable == null) { if (renderer instanceof Renderable) { renderable = (Renderable)renderer; } else { renderable = net.sf.jasperreports.engine.RenderableUtil.getWrappingRenderable(renderer); } } if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_6_0_2) { horizontalImageAlign = net.sf.jasperreports.engine.type.HorizontalAlignEnum.getHorizontalImageAlignEnum(horizontalAlignmentValue); verticalImageAlign = net.sf.jasperreports.engine.type.VerticalAlignEnum.getVerticalImageAlignEnum(verticalAlignmentValue); horizontalAlignmentValue = null; verticalAlignmentValue = null; } }
/** * */ private void writeChart(JRChart chart) throws IOException { writer.startElement(JRXmlConstants.ELEMENT_chart); writer.addAttribute(JRXmlConstants.ATTRIBUTE_isShowLegend, chart.getShowLegend()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, chart.getEvaluationTimeValue(), EvaluationTimeEnum.NOW); if (chart.getEvaluationTimeValue() == EvaluationTimeEnum.GROUP) { writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup, chart.getEvaluationGroup().getName()); } writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkType, chart.getLinkType(), HyperlinkTypeEnum.NONE.getName()); writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkTarget, chart.getLinkTarget(), HyperlinkTargetEnum.SELF.getName()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_bookmarkLevel, chart.getBookmarkLevel(), JRAnchor.NO_BOOKMARK); writer.addAttribute(JRXmlConstants.ATTRIBUTE_customizerClass, chart.getCustomizerClass()); writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_renderType, chart.getRenderType()); if(isNewerVersionOrEqual(JRConstants.VERSION_3_1_0)) { writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_theme, chart.getTheme()); } writeReportElement(chart); writeBox(chart.getLineBox()); // write title writer.startElement(JRXmlConstants.ELEMENT_chartTitle); writer.addAttribute(JRXmlConstants.ATTRIBUTE_position, chart.getTitlePositionValue()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_color, chart.getOwnTitleColor()); writeFont(chart.getTitleFont()); if (chart.getTitleExpression() != null) { writeExpression(JRXmlConstants.ELEMENT_titleExpression, chart.getTitleExpression(), false); } writer.closeElement(); // write subtitle writer.startElement(JRXmlConstants.ELEMENT_chartSubtitle); writer.addAttribute(JRXmlConstants.ATTRIBUTE_color, chart.getOwnSubtitleColor()); writeFont(chart.getSubtitleFont()); if (chart.getSubtitleExpression() != null) { writeExpression(JRXmlConstants.ELEMENT_subtitleExpression, chart.getSubtitleExpression(), false); } writer.closeElement(); // write chartLegend writer.startElement(JRXmlConstants.ELEMENT_chartLegend); if (chart.getOwnLegendColor() != null) { writer.addAttribute(JRXmlConstants.ATTRIBUTE_textColor, chart.getOwnLegendColor()); } if (chart.getOwnLegendBackgroundColor() != null) { writer.addAttribute(JRXmlConstants.ATTRIBUTE_backgroundColor, chart.getOwnLegendBackgroundColor()); } writer.addAttribute(JRXmlConstants.ATTRIBUTE_position, chart.getLegendPositionValue()); writeFont(chart.getLegendFont()); writer.closeElement(); writeExpression(JRXmlConstants.ELEMENT_anchorNameExpression, chart.getAnchorNameExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkReferenceExpression, chart.getHyperlinkReferenceExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkWhenExpression, chart.getHyperlinkWhenExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkAnchorExpression, chart.getHyperlinkAnchorExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkPageExpression, chart.getHyperlinkPageExpression(), false); writeExpression(JRXmlConstants.ELEMENT_hyperlinkTooltipExpression, chart.getHyperlinkTooltipExpression(), false); writeHyperlinkParameters(chart.getHyperlinkParameters()); writer.closeElement(); }
/** * */ public void writeImage( JRImage image, String imageName) { if(image != null) { write( "JRDesignImage " + imageName + " = new JRDesignImage(jasperDesign);\n"); write( imageName + ".setScaleImage({0});\n", image.getOwnScaleImageValue()); write( imageName + ".setHorizontalImageAlign({0});\n", image.getOwnHorizontalImageAlign()); write( imageName + ".setVerticalImageAlign({0});\n", image.getOwnVerticalImageAlign()); write( imageName + ".setUsingCache({0});\n", image.getUsingCache()); write( imageName + ".setLazy({0});\n", image.isLazy(), false); write( imageName + ".setOnErrorType({0});\n",image.getOnErrorTypeValue(), OnErrorTypeEnum.ERROR); write( imageName + ".setEvaluationTime({0});\n", image.getEvaluationTimeValue(), EvaluationTimeEnum.NOW); write( imageName + ".setEvaluationGroup({0});\n", getGroupName(image.getEvaluationGroup())); if(image.getLinkType() != null) { write( imageName + ".setLinkType(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(image.getLinkType()), HyperlinkTypeEnum.NONE.getName()); } if(image.getLinkTarget() != null) { write( imageName + ".setLinkTarget(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(image.getLinkTarget()), HyperlinkTargetEnum.SELF.getName()); } write( imageName + ".setBookmarkLevel({0, number, #});\n", image.getBookmarkLevel(), JRAnchor.NO_BOOKMARK); writeReportElement( image, imageName); writeBox( image.getLineBox(), imageName + ".getLineBox()"); writeGraphicElement( image, imageName); writeExpression( image.getExpression(), imageName, "Expression"); writeExpression( image.getAnchorNameExpression(), imageName, "AnchorNameExpression"); writeExpression( image.getHyperlinkReferenceExpression(), imageName, "HyperlinkReferenceExpression"); writeExpression( image.getHyperlinkWhenExpression(), imageName, "HyperlinkWhenExpression"); writeExpression( image.getHyperlinkAnchorExpression(), imageName, "HyperlinkAnchorExpression"); writeExpression( image.getHyperlinkPageExpression(), imageName, "HyperlinkPageExpression"); writeExpression( image.getHyperlinkTooltipExpression(), imageName, "HyperlinkTooltipExpression"); writeHyperlinkParameters( image.getHyperlinkParameters(), imageName); flush(); } }
/** * */ public void writeTextField( JRTextField textField, String textFieldName) { if(textField != null) { write( "JRDesignTextField " + textFieldName + " = new JRDesignTextField(jasperDesign);\n"); write( textFieldName + ".setBold({0});\n", textField.isOwnBold()); write( textFieldName + ".setStretchWithOverflow({0});\n", textField.isStretchWithOverflow(), false); write( textFieldName + ".setEvaluationTime({0});\n", textField.getEvaluationTimeValue(), EvaluationTimeEnum.NOW); write( textFieldName + ".setEvaluationGroup({0});\n", getGroupName(textField.getEvaluationGroup())); write( textFieldName + ".setPattern(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(textField.getOwnPattern())); write( textFieldName + ".setBlankWhenNull({0});\n", textField.isOwnBlankWhenNull()); if(textField.getLinkType() != null) { write( textFieldName + ".setLinkType(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(textField.getLinkType()), HyperlinkTypeEnum.NONE.getName()); } if(textField.getLinkTarget() != null) { write( textFieldName + ".setLinkTarget(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(textField.getLinkTarget()), HyperlinkTargetEnum.SELF.getName()); } write( textFieldName + ".setBookmarkLevel({0, number, #});\n", textField.getBookmarkLevel(), JRAnchor.NO_BOOKMARK); writeReportElement( textField, textFieldName); writeBox( textField.getLineBox(), textFieldName + ".getLineBox()"); writeTextElement( textField, textFieldName); writeExpression( textField.getExpression(), textFieldName, "Expression"); writeExpression( textField.getPatternExpression(), textFieldName, "PatternExpression"); writeExpression( textField.getAnchorNameExpression(), textFieldName, "AnchorNameExpression"); writeExpression( textField.getHyperlinkReferenceExpression(), textFieldName, "HyperlinkReferenceExpression"); writeExpression( textField.getHyperlinkWhenExpression(), textFieldName, "HyperlinkWhenExpression"); writeExpression( textField.getHyperlinkAnchorExpression(), textFieldName, "HyperlinkAnchorExpression"); writeExpression( textField.getHyperlinkPageExpression(), textFieldName, "HyperlinkPageExpression"); writeExpression( textField.getHyperlinkTooltipExpression(), textFieldName, "HyperlinkTooltipExpression"); writeHyperlinkParameters( textField.getHyperlinkParameters(), textFieldName); flush(); } }
/** * */ private void writeChart( JRChart chart, String chartName) { if(chart != null) { write( chartName + ".setShowLegend({0});\n", getBooleanText(chart.getShowLegend())); write( chartName + ".setEvaluationTime({0});\n", chart.getEvaluationTimeValue(), EvaluationTimeEnum.NOW); write( chartName + ".setEvaluationGroup({0});\n", getGroupName(chart.getEvaluationGroup())); if(chart.getLinkType() != null) { write( chartName + ".setLinkType(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(chart.getLinkType()), HyperlinkTypeEnum.NONE.getName()); } if(chart.getLinkTarget() != null) { write( chartName + ".setLinkTarget(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(chart.getLinkTarget()), HyperlinkTargetEnum.SELF.getName()); } write( chartName + ".setBookmarkLevel({0, number, #});\n", chart.getBookmarkLevel(), JRAnchor.NO_BOOKMARK); if(chart.getCustomizerClass() != null) { write( chartName + ".setCustomizerClass(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(chart.getCustomizerClass())); } write( chartName + ".setRenderType(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(chart.getRenderType())); write( chartName + ".setTheme(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(chart.getTheme())); writeReportElement( chart, chartName); writeBox( chart.getLineBox(), chartName + ".getLineBox()"); write( chartName + ".setTitlePosition({0});\n", chart.getTitlePositionValue()); write( chartName + ".setTitleColor({0});\n", chart.getOwnTitleColor()); if(chart.getTitleFont() != null) { write( chartName + ".setTitleFont(new JRBaseFont());\n"); writeFont( chart.getTitleFont(), chartName + ".getTitleFont()"); } writeExpression( chart.getTitleExpression(), chartName, "TitleExpression"); write( chartName + ".setSubtitleColor({0});\n", chart.getOwnSubtitleColor()); if(chart.getSubtitleFont() != null) { write( chartName + ".setSubtitleFont(new JRBaseFont());\n"); writeFont( chart.getSubtitleFont(), chartName + ".getSubtitleFont()"); } writeExpression( chart.getSubtitleExpression(), chartName, "SubtitleExpression"); write( chartName + ".setLegendColor({0});\n", chart.getOwnLegendColor()); write( chartName + ".setLegendBackgroundColor({0});\n", chart.getOwnLegendBackgroundColor()); write( chartName + ".setLegendPosition({0});\n", chart.getLegendPositionValue()); if(chart.getLegendFont() != null) { write( chartName + ".setLegendFont(new JRBaseFont());\n"); writeFont( chart.getLegendFont(), chartName + ".getLegendFont()"); } writeExpression( chart.getAnchorNameExpression(), chartName, "AnchorNameExpression"); writeExpression( chart.getHyperlinkReferenceExpression(), chartName, "HyperlinkReferenceExpression"); writeExpression( chart.getHyperlinkWhenExpression(), chartName, "HyperlinkWhenExpression");//FIXMENOW can we reuse hyperlink write method? writeExpression( chart.getHyperlinkAnchorExpression(), chartName, "HyperlinkAnchorExpression"); writeExpression( chart.getHyperlinkPageExpression(), chartName, "HyperlinkPageExpression"); writeExpression( chart.getHyperlinkTooltipExpression(), chartName, "HyperlinkTooltipExpression"); writeHyperlinkParameters( chart.getHyperlinkParameters(), chartName); flush(); } }
/** * @deprecated Replaced by {@link #setHyperlinkTarget(HyperlinkTargetEnum)}. */ public void setHyperlinkTarget(byte hyperlinkTarget) { setHyperlinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget)); }
/** * */ public void setHyperlinkTarget(HyperlinkTargetEnum hyperlinkTarget) { setLinkTarget(JRHyperlinkHelper.getLinkTarget(hyperlinkTarget)); }
/** * @deprecated Replaced by {@link #getLinkTarget(HyperlinkTargetEnum)}. */ public static String getLinkTarget(byte hyperlinkTarget) { return getLinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget)); }
@Override public HyperlinkTargetEnum getHyperlinkTargetValue() { return ((JRTemplateImage)this.template).getHyperlinkTargetValue(); }
@Override public void setHyperlinkTarget(HyperlinkTargetEnum hyperlinkTarget) { throw new UnsupportedOperationException(); }
@Override public HyperlinkTargetEnum getHyperlinkTargetValue() { return ((JRTemplateText)this.template).getHyperlinkTargetValue(); }
/** * */ public HyperlinkTargetEnum getHyperlinkTargetValue() { return JRHyperlinkHelper.getHyperlinkTargetValue(getLinkTarget()); }