Java 类net.sf.jasperreports.engine.xml.JRXmlBaseWriter 实例源码

项目:jasperreports    文件:AbstractPartComponentXmlWriter.java   
/**
 * 
 */
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;
}
项目:jasperreports    文件:AbstractComponentXmlWriter.java   
/**
 * 
 */
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;
}
项目:jasperreports-wms-component    文件:WmsMapComponentsXmlWriter.java   
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;
}
项目:jasperreports    文件:CastorUtil.java   
private XMLContext getWriteXmlContext()
{
    String targetVersion = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(
            JRXmlBaseWriter.PROPERTY_REPORT_VERSION);
    if (log.isDebugEnabled())
    {
        log.debug("using write mappings for version " + targetVersion);
    }

    return getXmlContext(CASTOR_WRITE_XML_CONTEXT_KEY, targetVersion);
}
项目:PDFReporter-Studio    文件:JRXmlWriterHelper.java   
public static String writeReport(JasperReportsContext jrContext, JRReport report, String encoding, String version)
        throws Exception {
    encoding = fixencoding(encoding);
    if (!writers.contains(version))
        version = LAST_VERSION;
    if (jrContext == null)
        jrContext = JasperReportsConfiguration.getDefaultJRConfig();
    jrContext.removeProperty(JRXmlBaseWriter.PROPERTY_REPORT_VERSION);
    if (writers.contains(version))
        jrContext.setProperty(JRXmlBaseWriter.PROPERTY_REPORT_VERSION, version);
    if (report != null) {
        // jrContext.setProperty("net.sf.jasperreports.components.table.version", version);
        String xml = new JRXmlWriter(jrContext).write(report, encoding);
        // request Bug 37455 - [Case #48613] Simple jrxml timestamp on Save or Save As
        String timestamp = "<!-- " + DateFormatUtils.ISO_DATETIME_FORMAT.format(new Date()) + " -->\r\n";
        // Replace with a more meaningful JR version
        if(version.equals(LAST_VERSION)){
            version = getInstalledJasperReportsVersion();
        }
        // Get JSS bundle version
        String jssPluginVersion = JaspersoftStudioPlugin.getInstance().getBundle().getVersion().toString();
        String jrVersionTxt = " using PDFReporter Library version " + version + " ";
        xml = xml
                .replaceFirst(
                        "<jasperReport ", "<!-- Created with PDFReporter Studio version " + jssPluginVersion + jrVersionTxt + " -->\r\n" + timestamp + "<jasperReport "); //$NON-NLS-1$ //$NON-NLS-2$
        return xml;
    }
    return null;
}
项目:ireport-fork    文件:VersionJRContext.java   
@Override
public Map<String, String> getProperties() {
    Map map = super.getProperties();


    map.remove(JRXmlBaseWriter.PROPERTY_REPORT_VERSION);
    if (version != null && version.length() > 0)
    {
        map.put(JRXmlBaseWriter.PROPERTY_REPORT_VERSION, version);
    }
    return map;
}
项目:ireport-fork    文件:VersionJRContext.java   
@Override
public String getProperty(String key) {


    System.out.println("Getting the property: " + key);
    if (key.equals(JRXmlBaseWriter.PROPERTY_REPORT_VERSION))
    {

        return version.equals("") ? null : version;
    }

    return super.getProperty(key);
}