
Rendering customized NLS information
Except for providing customized NLS information for a specific report set using NLS Editor in JReport Designer, now an NLSBundleInfo interface is provided in JReport Engine Bean for rendering customized NLS information to different report sets via API dynamically.
These methods are contained in the NLSBundleInfo interface:
- getBundleUsage()
An integer value representing the usage of the NLS information, defined as INFOTYPE_TEXTREPLACE, INFOTYPE_DATAMAPPING, or INFOTYPE_DATAMAPPING + INFOTYPE_TEXTREPLACE.
- getDataMapped(String dataValue)
It will be called if getBundleUsage() is INFOTYPE_DATAMAPPING or INFOTYPE_DATAMAPPING + INFOTYPE_TEXTREPLACE.
- getTextReplace(int replaceID, String originText)
It will be called if getBundleUsage() is INFOTYPE_TEXTREPLACE or INFOTYPE_DATAMAPPING + INFOTYPE_TEXTREPLACE.
- getFontStyleReplace(String fontFace, double fs_inch)
It will be called if getBundleUsage() is INFOTYPE_TEXTREPLACE or INFOTYPE_DATAMAPPING + INFOTYPE_TEXTREPLACE.
- getIsEmptyBundle()
It specifies whether the NLS information is empty. Value type is boolean.
Parameters:
- String dataValue - Value of the DBField, summary and formula.
- int replaceID - An interger value, such as TEXTREPLACE_FORLABEL, TEXTREPLACE_FORTOCANCHOR, TEXTREPLACE_FORPROMPT, TEXTREPLACE_FORFORMAT and TEXTREPLACE_FORCOLUMN.
- String originText - The original text in labels, parameter prompts, TOC anchors, display texts of columns and the display format of fields.
- String fontFace - Field's font face.
- double fs_inch - Field's font size, measured in inch.
Suppose you have had a class to implement the NLSBundleInfo interface, you can then use the Engine Bean to render customized NLS information to a report set as follows:
bean.setNLSBundleInfo( info );
Reference: See the sample class MyNLSBundleInfo.java in <install_root>\help\designer\samples about how to implement the NLSBundleInfo interface.
