5. ReportDesigner Utilities

org.pentaho.reportdesigner.lib.client.i18n.TranslationManager

The translation manager can be used to load translations using keys. Regular java property files are used as the underlying storage mechanism (see /res/Translations.properties).
The values in the property file use standard MessageFormat syntax to specify parameters.

The common case to load mnemonics and mnemonic indices is simplified by extending the syntax to use underscores:

SaveReportCommand.Text=_Save

The mnemonic will be set to 'S' and index to 0.

The values can be accessed using the TranslationManager:

String text = TranslationManager.getInstance().getTranslation("R", "SaveReportCommand.Text");
int mnemonic = TranslationManager.getInstance().getMnemonic("R", "SaveReportCommand.Text");
int displayedMnemonicIndex = TranslationManager.getInstance().getDisplayedMnemonicIndex("R", "SaveReportCommand.Text");




org.pentaho.reportdesigner.lib.client.components.CenterPanelDialog

The CenterPanelDialog class is an extension to the regular JDialog. The method setCenterPanel is used to set the actual content of the dialog (without buttons).

Dialog buttons (sizing, default command, cancel command)
Buttons can be added using CenterPanelDialog#setButtons.
The first two parameters of setButtons are used to mark the default and cancel button. A dialog containing one close button thus leads in a possibly strange looking call like:

dialog.setButtons(closeButton/*to mark as default*/, closeButton/*to mark as cancel*/, closeButton/*to really add the button*/);

passing null as an argument will add a small gap between buttons e.g:

dialog.setButtons(okButton, cancelButton, okButton, cancelButton, null, resetButton);

will lead to a dialog with three buttons ("OK", "Cancel", "Reset") with a small gap between the cancel and the reset button. okButton is the default, cancelButton is used when disposing the dialog.

Initially focused component
CenterPanelDialog#setInitialFocusedComponent

Extended modality (only effective when running on Java 6)

org.pentaho.reportdesigner.lib.client.util.UncaughtExcpetionsModel

All unexpected exceptions resulting in a possibly corrupted state of the ReportDesigner should be added to the UncaughtExcfeptionsModel. This usually leads in a red blinking warning message on the ReportDialog.



org.pentaho.reportdesigner.lib.client.util.FontUtils

FontUtils can be used to derive fonts. StyleContext is internally used to prevent a bug where Japanese characters of a derived font didn't render anymore. Additionally StyleContext uses a simple cache that might speed up the derive operation a little bit.


org.pentaho.reportdesigner.lib.client.util.IOUtil

IOUtil is used to close streams (always close streams accessing native resources).