⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reportconfiguration.java

📁 Java的Web报表库
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
  }

  /**
   * Returns true, if the export to CSV files should be available in the preview
   * dialog. This setting does not limit the report's ability to be exported as
   * CSV file, it just controls whether the Export plugin will be added to the
   * Dialog.
   *
   * @return true, if CSV export is enabled, false otherwise.
   */
  public boolean isEnableExportCSV()
  {
    return getConfigProperty(ENABLE_EXPORT_CSV, "false").equalsIgnoreCase("true");
  }

  /**
   * Defines, whether the CSV export plugin will be activated in the preview dialog.
   *
   * @param enableExportCSV true, if the export plugin should be active, false otherwise.
   */
  public void setEnableExportCSV(final boolean enableExportCSV)
  {
    setConfigProperty(ENABLE_EXPORT_CSV, String.valueOf(enableExportCSV));
  }

  /**
   * Returns true, if the export to HTML files should be available in the preview
   * dialog. This setting does not limit the report's ability to be exported as
   * HTML file, it just controls whether the Export plugin will be added to the
   * Dialog.
   *
   * @return true, if HTML export is enabled, false otherwise.
   */
  public boolean isEnableExportHTML()
  {
    return getConfigProperty(ENABLE_EXPORT_HTML, "false").equalsIgnoreCase("true");
  }

  /**
   * Defines, whether the HTML export plugin will be activated in the preview dialog.
   *
   * @param enableExportHTML true, if the export plugin should be active, false otherwise.
   */
  public void setEnableExportHTML(final boolean enableExportHTML)
  {
    setConfigProperty(ENABLE_EXPORT_HTML, String.valueOf(enableExportHTML));
  }

  /**
   * Returns true, if the export to plain text files should be available in the preview
   * dialog. This setting does not limit the report's ability to be exported as
   * plain text file, it just controls whether the Export plugin will be added to the
   * Dialog.
   *
   * @return true, if PlainText export is enabled, false otherwise.
   */
  public boolean isEnableExportPlain()
  {
    return getConfigProperty(ENABLE_EXPORT_PLAIN, "false").equalsIgnoreCase("true");
  }

  /**
   * Defines, whether the PlainText export plugin will be activated in the preview dialog.
   *
   * @param enableExportPlain true, if the export plugin should be active, false otherwise.
   */
  public void setEnableExportPlain(final boolean enableExportPlain)
  {
    setConfigProperty(ENABLE_EXPORT_PLAIN, String.valueOf(enableExportPlain));
  }

  /**
   * Returns true, if the export to PDF files should be available in the preview
   * dialog. This setting does not limit the report's ability to be exported as
   * PDF file, it just controls whether the Export plugin will be added to the
   * Dialog.
   *
   * @return true, if PDF export is enabled, false otherwise.
   */
  public boolean isEnableExportPDF()
  {
    return getConfigProperty(ENABLE_EXPORT_PDF, "false").equalsIgnoreCase("true");
  }

  /**
   * Defines, whether the PDF export plugin will be activated in the preview dialog.
   *
   * @param enableExportPDF true, if the export plugin should be active, false otherwise.
   */
  public void setEnableExportPDF(final boolean enableExportPDF)
  {
    setConfigProperty(ENABLE_EXPORT_PDF, String.valueOf(enableExportPDF));
  }

  /**
   * Returns true, if the export to Excel files should be available in the preview
   * dialog. This setting does not limit the report's ability to be exported as
   * Excel file, it just controls whether the Export plugin will be added to the
   * Dialog.
   *
   * @return true, if Excel export is enabled, false otherwise.
   */
  public boolean isEnableExportExcel()
  {
    return getConfigProperty(ENABLE_EXPORT_EXCEL, "false").equalsIgnoreCase("true");
  }

  /**
   * Defines, whether the Excel export plugin will be activated in the preview dialog.
   *
   * @param enableExportExcel true, if the export plugin should be active, false otherwise.
   */
  public void setEnableExportExcel(final boolean enableExportExcel)
  {
    setConfigProperty(ENABLE_EXPORT_EXCEL, String.valueOf(enableExportExcel));
  }

  /**
   * Checks, whether a stricter error handling is applied to the report processing.
   * If set to true, then errors in the handling of report events will cause the report
   * processing to fail. This is a safe-and-paranoid setting, life is simpler with
   * this set to false. The property defaults to false, as this is the old behaviour.
   * <p>
   * A properly defined report should not throw exceptions, so it is safe to set this
   * to true.
   *
   * @return true, if the strict handling is enabled, false otherwise.
   */
  public boolean isStrictErrorHandling()
  {
    return getConfigProperty(STRICT_ERRORHANDLING,
        STRICT_ERRORHANDLING_DEFAULT).equalsIgnoreCase("true");
  }

  /**
   * Defines, whether a stricter error handling is applied to the report processing.
   * If set to true, then errors in the handling of report events will cause the report
   * processing to fail. This is a safe-and-paranoid setting, life is simpler with
   * this set to false. The property defaults to false, as this is the old behaviour.
   * <p>
   * A properly defined report should not throw exceptions, so it is safe to set this
   * to true.
   *
   * @param strictErrorHandling if set to true, then errors in the event dispatching will
   * cause the reporting to fail.
   */
  public void setStrictErrorHandling(final boolean strictErrorHandling)
  {
    setConfigProperty(STRICT_ERRORHANDLING, String.valueOf(strictErrorHandling));
  }

  /**
   * Defines the loader settings for the available encodings shown to the user.
   * The property defaults to AVAILABLE_ENCODINGS_ALL.
   *
   * @return either AVAILABLE_ENCODINGS_ALL, AVAILABLE_ENCODINGS_FILE or AVAILABLE_ENCODINGS_NONE.
   */
  public String getAvailableEncodings()
  {
    return getConfigProperty(AVAILABLE_ENCODINGS, AVAILABLE_ENCODINGS_ALL);
  }


  /**
   * Defines the loader settings for the available encodings shown to the user.
   * The property defaults to AVAILABLE_ENCODINGS_ALL.
   *
   * @return either AVAILABLE_ENCODINGS_ALL, AVAILABLE_ENCODINGS_FILE or AVAILABLE_ENCODINGS_NONE.
   */
  public String getEncodingsDefinitionFile()
  {
    return getConfigProperty(ENCODINGS_DEFINITION_FILE, ENCODINGS_DEFINITION_FILE_DEFAULT);
  }

  /**
   * Returns the plain text encoding property value.
   *
   * @return the plain text encoding property value.
   */
  public String getTextTargetEncoding()
  {
    return getConfigProperty(TEXT_OUTPUT_ENCODING, TEXT_OUTPUT_ENCODING_DEFAULT);
  }

  /**
   * Sets the plain text encoding property value.
   *
   * @param targetEncoding  the new encoding.
   */
  public void setXMLTargetEncoding(final String targetEncoding)
  {
    setConfigProperty(TEXT_OUTPUT_ENCODING, targetEncoding);
  }

  /**
   * Returns the HTML encoding property value.
   *
   * @return the HTML encoding property value.
   */
  public String getHTMLTargetEncoding()
  {
    return getConfigProperty(HTML_OUTPUT_ENCODING, HTML_OUTPUT_ENCODING_DEFAULT);
  }

  /**
   * Sets the HTML encoding property value.
   *
   * @param targetEncoding  the new encoding.
   */
  public void setHTMLTargetEncoding(final String targetEncoding)
  {
    setConfigProperty(HTML_OUTPUT_ENCODING, targetEncoding);
  }

  /**
   * Returns the CSV encoding property value.
   *
   * @return the CSV encoding property value.
   */
  public String getCSVTargetEncoding()
  {
    return getConfigProperty(CSV_OUTPUT_ENCODING, CSV_OUTPUT_ENCODING_DEFAULT);
  }

  /**
   * Sets the CSV encoding property value.
   *
   * @param targetEncoding  the new encoding.
   */
  public void setCSVTargetEncoding(final String targetEncoding)
  {
    setConfigProperty(CSV_OUTPUT_ENCODING, targetEncoding);
  }

  /**
   * Helper method for serialization.
   *
   * @param out the output stream where to write the object.
   * @throws IOException if errors occur while writing the stream.
   */
  private void writeObject(final ObjectOutputStream out)
      throws IOException
  {
    out.defaultWriteObject();
    if (parentConfiguration == globalConfig)
    {
      out.writeBoolean(false);
    }
    else
    {
      out.writeBoolean(true);
      out.writeObject(parentConfiguration);
    }
  }

  /**
   * Helper method for serialization.
   *
   * @param in the input stream from where to read the serialized object.
   * @throws IOException when reading the stream fails.
   * @throws ClassNotFoundException if a class definition for a serialized object
   * could not be found.
   */
  private void readObject(final ObjectInputStream in)
      throws IOException, ClassNotFoundException
  {
    in.defaultReadObject();
    final boolean readParent = in.readBoolean();
    if (readParent)
    {
      parentConfiguration = (ReportConfiguration) in.readObject();
    }
    else
    {
      parentConfiguration = ReportConfiguration.getGlobalConfig();
    }
  }

  /**
   * Searches all property keys that start with a given prefix.
   *
   * @param prefix the prefix that all selected property keys should share
   * @return the properties as iterator.
   */
  public Iterator findPropertyKeys(final String prefix)
  {
    final ArrayList keys = new ArrayList();
    collectPropertyKeys(prefix, this, keys);
    return Collections.unmodifiableList(keys).iterator();
  }

  /**
   * Collects property keys from this and all parent report configurations, which
   * start with the given prefix.
   *
   * @param prefix the prefix, that selects the property keys.
   * @param config the currently processed report configuration.
   * @param collector the target list, that should receive all valid keys.
   */
  private void collectPropertyKeys(final String prefix, final ReportConfiguration config,
                                   final ArrayList collector)
  {
    final Enumeration enum = config.getConfigProperties();
    while (enum.hasMoreElements())
    {
      final String key = (String) enum.nextElement();
      if (key.startsWith(prefix))
      {
        collector.add(key);
      }
    }

    if (parentConfiguration != null)
    {
      collectPropertyKeys(prefix, config.parentConfiguration, collector);
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -