/** * Formats the message stored in the resource bundle (using a MessageFormat). * * @param key the resourcebundle key * @param param1 the parameter for the message * @return the formated string */ public static String getString(final String key, final Object... param1) { try { return bundle.formatMessage(key, param1); } catch (MissingResourceException e) { logger.warn("Missing localization: " + key, e); return '!' + key + '!'; } }
/** * Creates the progress dialog that monitors the export process. * * @return the progress monitor dialog. */ protected ReportProgressDialog createProgressDialog() { final ReportProgressDialog progressDialog = super.createProgressDialog(); progressDialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); progressDialog.setMessage( resources.getString("excel-export.progressdialog.message")); // $NON-NLS-1$ progressDialog.pack(); LibSwingUtil.positionFrameRandomly(progressDialog); return progressDialog; }
/** * Shows this dialog and (if the dialog is confirmed) saves the complete report into an PDF file. * * @param report the report being processed. * @return true or false. */ public boolean performExport(final MasterReport report) { final boolean result = performShowExportDialog( report, "org.pentaho.reporting.engine.classic.core.modules.gui.pdf.Dialog"); //$NON-NLS-1$ if (result == false) { // user canceled the dialog ... return false; } final ReportProgressDialog progressDialog; if (isProgressDialogEnabled( report, "org.pentaho.reporting.engine.classic.core.modules.gui.pdf.ProgressDialogEnabled")) { progressDialog = createProgressDialog(); if (report.getTitle() == null) { progressDialog.setTitle(getResources().getString("ProgressDialog.EMPTY_TITLE")); } else { progressDialog.setTitle( getResources().formatMessage("ProgressDialog.TITLE", report.getTitle())); } } else { progressDialog = null; } try { final PdfExportTask task = new PdfExportTask(report, progressDialog, getContext()); final Thread worker = new Thread(task); worker.start(); return true; } catch (Exception e) { PdfExportPlugin.logger.error("Failure while preparing the PDF export", e); // $NON-NLS-1$ getContext() .getStatusListener() .setStatus( StatusType.ERROR, resources.getString("PdfExportPlugin.USER_FAILED"), e); //$NON-NLS-1$ return false; } }
/** * Returns the accelerator key for the export action. * * @return The accelerator key. */ public KeyStroke getAcceleratorKey() { return resources.getOptionalKeyStroke("action.close.accelerator"); // $NON-NLS-1$ }
/** * Returns the short description for the export action. * * @return The short description. */ public String getShortDescription() { return resources.getString("action.close.description"); // $NON-NLS-1$ }
/** * Returns the display name for the export action. * * @return The display name. */ public String getDisplayName() { return resources.getString("action.close.name"); // $NON-NLS-1$ }
/** * Returns the mnemonic key code. * * @return The code. */ public Integer getMnemonicKey() { return resources.getOptionalMnemonic("action.close.mnemonic"); // $NON-NLS-1$ }
public static KeyStroke getOptionalKeyStroke(final String key, final int mask) { return bundle.getOptionalKeyStroke(key, mask); }
public static KeyStroke getOptionalKeyStroke(final String key) { return bundle.getOptionalKeyStroke(key); }
public static Integer getOptionalMnemonic(final String key) { return bundle.getOptionalMnemonic(key); }
public static Icon getIcon(final String key) { return bundle.getIcon(key); }
public static Icon getIcon(final String key, final boolean large) { return bundle.getIcon(key, large); }
/** * Returns the display name. * * @return The display name. */ public String getDisplayName() { return resources.getString("action.export-to-excel.name"); // $NON-NLS-1$ }
/** * Returns the mnemonic key code for the action associated with the dialog. * * @return The key code. */ public Integer getMnemonicKey() { return resources.getOptionalMnemonic("action.export-to-excel.mnemonic"); // $NON-NLS-1$ }
/** * Returns the accelerator key for the action associated with the dialog. * * @return The key stroke. */ public KeyStroke getAcceleratorKey() { return resources.getOptionalKeyStroke("action.export-to-excel.accelerator"); // $NON-NLS-1$ }
/** * Returns a short description for the Excel dialog. * * @return The description. */ public String getShortDescription() { return resources.getString("action.export-to-excel.description"); // $NON-NLS-1$ }