📄 reportconfiguration.java
字号:
/** The default 'disable logging' property value. */
public static final String STRICT_ERRORHANDLING_DEFAULT = "false";
/** The 'disable logging' property key. */
public static final String WARN_INVALID_COLUMNS
= "com.jrefinery.report.WarnInvalidColumns";
/** The default 'disable logging' property value. */
public static final String WARN_INVALID_COLUMNS_DEFAULT = "false";
/** The 'disable logging' property key. */
public static final String DISABLE_LOGGING
= "com.jrefinery.report.NoDefaultDebug";
/** The default 'disable logging' property value. */
public static final String DISABLE_LOGGING_DEFAULT = "false";
/** The 'log level' property key. */
public static final String LOGLEVEL
= "com.jrefinery.report.LogLevel";
/** The default 'log level' property value. */
public static final String LOGLEVEL_DEFAULT = "Info";
/** The 'log target' property key. */
public static final String LOGTARGET = "com.jrefinery.report.LogTarget";
/** The default 'log target' property value. */
public static final String LOGTARGET_DEFAULT = SystemOutLogTarget.class.getName();
/** The 'PDF auto init' property key. */
public static final String PDFTARGET_AUTOINIT
= "com.jrefinery.report.targets.pageable.output.PDFOutputTarget.AutoInit";
/** The default 'PDF auto init' property value. */
public static final String PDFTARGET_AUTOINIT_DEFAULT = "true";
/** The 'PDF embed fonts' property key. */
public static final String PDFTARGET_EMBED_FONTS
= "com.jrefinery.report.targets.pageable.output.PDFOutputTarget.default.EmbedFonts";
/** The default 'PDF embed fonts' property value. */
public static final String PDFTARGET_EMBED_FONTS_DEFAULT = "true";
/** The 'PDF encoding' property key. */
public static final String PDFTARGET_ENCODING
= "com.jrefinery.report.targets.pageable.output.PDFOutputTarget.default.Encoding";
/** The default 'PDF encoding' property value. */
public static final String PDFTARGET_ENCODING_DEFAULT = "Cp1252";
/** The 'ResultSet factory mode'. */
public static final String RESULTSET_FACTORY_MODE
= "com.jrefinery.report.TableFactoryMode";
/** Enable DTD validation of the parsed XML. */
public static final String PARSER_VALIDATE
= "com.jrefinery.report.io.validate";
/** disable DTD validation by default. */
public static final String PARSER_VALIDATE_DEFAULT = "true";
/**
* The default resourcebundle that should be used for ResourceFileFilter.
* This property must be applied by the parser.
*/
public static final String REPORT_RESOURCE_BUNDLE
= "com.jrefinery.report.ResourceBundle";
/** Enable stricter table layouting for all TableProcessors. */
public static final String STRICT_TABLE_LAYOUT
= "com.jrefinery.report.targets.table.StrictLayout";
/** Disable strict layout by default. */
public static final String STRICT_TABLE_LAYOUT_DEFAULT = "false";
/** The property that defines whether to enable PDF export in the PreviewFrame. */
public static final String ENABLE_EXPORT_PDF
= "com.jrefinery.report.preview.plugin.pdf";
/** The property that defines whether to enable CSV export in the PreviewFrame. */
public static final String ENABLE_EXPORT_CSV
= "com.jrefinery.report.preview.plugin.csv";
/** The property that defines whether to enable Html export in the PreviewFrame. */
public static final String ENABLE_EXPORT_HTML
= "com.jrefinery.report.preview.plugin.html";
/** The property that defines whether to enable Excel export in the PreviewFrame. */
public static final String ENABLE_EXPORT_EXCEL
= "com.jrefinery.report.preview.plugin.excel";
/** The property that defines whether to enable PlainText export in the PreviewFrame. */
public static final String ENABLE_EXPORT_PLAIN
= "com.jrefinery.report.preview.plugin.plain";
/** The property that defines which encodings are available in the export dialogs. */
public static final String AVAILABLE_ENCODINGS
= "com.jrefinery.report.encodings.available";
/** The encodings available properties value for all properties. */
public static final String AVAILABLE_ENCODINGS_ALL = "all";
/** The encodings available properties value for properties defined in the properties file. */
public static final String AVAILABLE_ENCODINGS_FILE = "file";
/**
* The encodings available properties value for no properties defined. The encoding selection
* will be disabled.
*/
public static final String AVAILABLE_ENCODINGS_NONE = "none";
/** The 'HTML encoding' property key. */
public static final String HTML_OUTPUT_ENCODING
= "com.jrefinery.report.targets.table.html.Encoding";
/** A default value of the 'HTML encoding' property key. */
public static final String HTML_OUTPUT_ENCODING_DEFAULT = "UTF-16";
/** The 'CSV encoding' property key. */
public static final String CSV_OUTPUT_ENCODING
= "com.jrefinery.report.targets.csv.Encoding";
/** A default value of the 'CSV encoding' property key. */
public static final String CSV_OUTPUT_ENCODING_DEFAULT = getPlatformDefaultEncoding();
/** The 'XML encoding' property key. */
public static final String TEXT_OUTPUT_ENCODING
= "com.jrefinery.report.targets.pageable.output.PlainText.Encoding";
/** A default value of the 'XML encoding' property key. */
public static final String TEXT_OUTPUT_ENCODING_DEFAULT = getPlatformDefaultEncoding();
/**
* Helper method to read the platform default encoding from the VM's system properties.
* @return the contents of the system property "file.encoding".
*/
private static String getPlatformDefaultEncoding()
{
try
{
return System.getProperty("file.encoding", "Cp1252");
}
catch (SecurityException se)
{
return "Cp1252";
}
}
/**
* The name of the properties file used to define the available encodings.
* The property points to a resources in the classpath, not to a real file!
*/
public static final String ENCODINGS_DEFINITION_FILE
= "com.jrefinery.report.encodings.file";
/**
* The default name for the encoding properties file. This property defaults to
* "/com/jrefinery/report/jfreereport-encodings.properties".
*/
public static final String ENCODINGS_DEFINITION_FILE_DEFAULT
= "/com/jrefinery/report/jfreereport-encodings.properties";
/** Storage for the configuration properties. */
private Properties configuration;
/** The parent configuration (null if this is the root configuration). */
private transient ReportConfiguration parentConfiguration;
/** The global configuration. */
private static transient ReportConfiguration globalConfig;
/**
* Default constructor.
*/
protected ReportConfiguration()
{
configuration = new Properties();
}
/**
* Creates a new report configuration.
*
* @param globalConfig the global configuration.
*/
public ReportConfiguration(final ReportConfiguration globalConfig)
{
this();
parentConfiguration = globalConfig;
}
/**
* Returns the configuration property with the specified key.
*
* @param key the property key.
*
* @return the property value.
*/
public String getConfigProperty(final String key)
{
return getConfigProperty(key, null);
}
/**
* Returns the configuration property with the specified key
* (or the specified default value if there is no such property).
* <p>
* If the property is not defined in this configuration, the code
* will lookup the property in the parent configuration.
*
* @param key the property key.
* @param defaultValue the default value.
*
* @return the property value.
*/
public String getConfigProperty(final String key, final String defaultValue)
{
String value = configuration.getProperty(key);
if (value == null)
{
if (isRootConfig())
{
value = defaultValue;
}
else
{
value = parentConfiguration.getConfigProperty(key, defaultValue);
}
}
return value;
}
/**
* Sets a configuration property.
*
* @param key the property key.
* @param value the property value.
*/
public void setConfigProperty(final String key, final String value)
{
if (key == null)
{
throw new NullPointerException();
}
if (value == null)
{
configuration.remove(key);
}
else
{
configuration.setProperty(key, value);
}
}
/**
* Returns true if this object has no parent.
*
* @return true, if this report is the root configuration, false otherwise.
*/
private boolean isRootConfig()
{
return parentConfiguration == null;
}
/**
* Returns the log level.
*
* @return the log level.
*/
public String getLogLevel()
{
return getConfigProperty(LOGLEVEL, LOGLEVEL_DEFAULT);
}
/**
* Sets the log level, which is read from the global report configuration at
* the point that the classloader loads the {@link Log} class.
* <p>
* Valid log levels are:
*
* <ul>
* <li><code>"Error"</code> - error messages;</li>
* <li><code>"Warn"</code> - warning messages;</li>
* <li><code>"Info"</code> - information messages;</li>
* <li><code>"Debug"</code> - debug messages;</li>
* </ul>
*
* Notes:
* <ul>
* <li>the setting is not case sensitive.</li>
* <li>changing the log level after the {@link Log} class has been
* loaded will have no effect.</li>
* <li>to turn of logging altogether, use the {@link #setDisableLogging} method.</li>
* </ul>
*
* @param level the new log level.
*/
public void setLogLevel(final String level)
{
setConfigProperty(LOGLEVEL, level);
}
/**
* Returns whether to search for ttf-fonts when the PDFOutputTarget is loaded.
*
* @return the PDFOutputTarget autoinitialisation value.
*/
public boolean isPDFTargetAutoInit()
{
return getConfigProperty(PDFTARGET_AUTOINIT,
PDFTARGET_AUTOINIT_DEFAULT).equalsIgnoreCase("true");
}
/**
* Sets the PDF target auto init status.
*
* @param autoInit the new status.
*/
public void setPDFTargetAutoInit(final boolean autoInit)
{
setConfigProperty(PDFTARGET_AUTOINIT, String.valueOf(autoInit));
}
/**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -