reportProcessor = createReportProcessor( fout ); reportProcessor.processReport(); statusListener.setStatus( StatusType.INFORMATION, messages.getString( "ReportExportTask.USER_EXPORT_COMPLETE" ), //$NON-NLS-1$ null ); reportProcessor.close();
/** * Creates a new PDF export task. */ public ReportExportTask( final MasterReport report, final SwingGuiContext swingGuiContext, String targetPath, Boolean createParentFolder ) { if ( report == null ) { throw new NullPointerException( "ReportExportTask(..): Report parameter cannot be null" ); } this.report = report; this.statusListener = swingGuiContext.getStatusListener(); // Check if the current Locale is supported: // If not, use the default (US) locale. Locale locale = swingGuiContext.getLocale(); try { ResourceBundle.getBundle( BASE_RESOURCE_CLASS, swingGuiContext.getLocale() ); } catch ( MissingResourceException e ) { locale = Locale.US; } this.messages = new Messages( locale, BASE_RESOURCE_CLASS, ObjectUtilities.getClassLoader( ReportExportTask.class ) ); this.targetPath = targetPath; this.createParentFolder = createParentFolder; }
/** * When an object implementing interface <code>Runnable</code> is used to create a thread, starting the thread causes * the object's <code>run</code> method to be called in that separately executing thread. * <p/> * The general contract of the method <code>run</code> is that it may take any action whatsoever. * * @see Thread#run() */ public void run() { try { targetFile = KettleVFS.getFileObject( targetPath ); if ( targetFile.exists() ) { if ( !targetFile.delete() ) { throw new ReportProcessingException( messages.getErrorString( "ReportExportTask.ERROR_0001_TARGET_EXISTS" ) ); //$NON-NLS-1$ } } if ( createParentFolder ) { targetFile.getParent().createFolder(); } execute(); } catch ( Exception ex ) { statusListener.setStatus( StatusType.ERROR, messages.getString( "ReportExportTask.USER_EXPORT_FAILED" ), ex ); //$NON-NLS-1$ logger.error( "Failed" ); //$NON-NLS-1$ } }
/** * Creates a new model. * * @param locale */ public EncodingComboBoxModel( final Locale locale ) { bundle = ResourceBundle.getBundle( EncodingComboBoxModel.BUNDLE_NAME, locale ); messages = new Messages( locale, SwingCommonModule.BUNDLE_NAME, ObjectUtilities.getClassLoader( SwingCommonModule.class ) ); ENCODING_DEFAULT_DESCRIPTION = messages.getString( "EncodingComboBoxModel.USER_ENCODING_DEFAULT_DESCRIPTION" ); //$NON-NLS-1$ encodings = new ArrayList(); listDataListeners = null; selectedIndex = -1; }
this.statusListener = swingGuiContext.getStatusListener(); this.messages = new Messages( swingGuiContext.getLocale(), PdfExportPlugin.BASE_RESOURCE_CLASS, ObjectUtilities .getClassLoader( PdfExportPlugin.class ) ); } else { this.messages = new Messages( Locale.getDefault(), PdfExportPlugin.BASE_RESOURCE_CLASS, ObjectUtilities .getClassLoader( PdfExportPlugin.class ) ); if ( targetFile.exists() ) { if ( targetFile.delete() == false ) { throw new ReportProcessingException( messages.getErrorString( "PdfExportTask.ERROR_0001_TARGET_EXISTS" ) ); //$NON-NLS-1$
/** * Get a parametrized formatted error message from the resource-bundle. The message consists of two parts. The first * part is the error numeric Id associated with the key used to identify the message in the resource file. For * instance, suppose the error key is MyClass.ERROR_0069_DONKEY_PUNCH. The first part of the error msg would be * "0069". The second part of the returned string is simply the <code>msg</code> parameter. * <p/> * Currently the format is: error key - error msg For instance: "0069 - You were punched by the donkey." * * @param key String containing the key that was used to obtain the <code>msg</code> parameter from the resource * file. * @param param1 the parameter for the message * @return String containing the formatted error message. */ public String getErrorString( final String key, final String... param1 ) { return formatErrorMessage( key, getString( key, param1 ) ); } }
/** * Defines the output text message. This text describes the export phases of the report processing. * * @param outputText * the output message. */ public void setOutputText( final String outputText ) { if ( outputText == null ) { throw new NullPointerException( messages.getErrorString( "ReportProgressDialog.ERROR_0001_OUTPUT_TEXT_NULL" ) ); //$NON-NLS-1$ } this.outputText = outputText; }
/** * 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 String getString( final String key, final String... param1 ) { try { return formatMessage( key, param1 ); } catch ( final MissingResourceException e ) { return '!' + key + '!'; } }
public FormulaFragmentCellEditor() { setLayout( new BorderLayout() ); final Action action = createExtendedEditorAction(); this.eventListenerList = new EventListenerList(); ellipsisButton = new EllipsisButton( "..." ); ellipsisButton.addActionListener( action ); comboBox = new JComboBox(); final ComboBoxEditor boxEditor = comboBox.getEditor(); if ( boxEditor instanceof BasicComboBoxEditor ) { final BasicComboBoxEditor basicComboBoxEditor = (BasicComboBoxEditor) boxEditor; final Object editorComponent = basicComboBoxEditor.getEditorComponent(); if ( editorComponent instanceof JTextField ) { final JTextField editorTextField = (JTextField) editorComponent; editorTextField.setDocument( new NonFilteringPlainDocument() ); } } comboBox.setRenderer( new EmptyValueListCellRenderer() ); comboBox.addActionListener( new SelectionAction() ); comboBox.getInputMap().put( KeyStroke.getKeyStroke( KeyEvent.VK_ESCAPE, 0 ), new CancelAction() ); comboBox.getInputMap().put( EditorMessages.getInstance().getKeyStroke ( "AbstractStringValueCellEditor.Popup.Accelerator" ), POPUP_EDITOR ); comboBox.setBorder( BorderFactory.createEmptyBorder() ); comboBox.setEditable( true ); add( comboBox, BorderLayout.CENTER ); add( ellipsisButton, BorderLayout.EAST ); formulaContext = new DefaultFormulaContext(); nullable = false; }
if ( in == null ) { final Messages messages = new Messages( locale, SwingCommonModule.BUNDLE_NAME, ObjectUtilities .getClassLoader( SwingCommonModule.class ) ); logger.warn( messages.getString( "EncodingComboBoxModel.WARN_ENCODING_FILE_NOT_FOUND", encFile ) ); //$NON-NLS-1$ } else { try { new Messages( locale, SwingCommonModule.BUNDLE_NAME, ObjectUtilities .getClassLoader( SwingCommonModule.class ) ); logger.warn( messages.getString( "EncodingComboBoxModel.WARN_ERROR_READING_ENCODING_FILE" ) + encFile, e ); //$NON-NLS-1$
this.statusListener = swingGuiContext.getStatusListener(); this.messages = new Messages( swingGuiContext.getLocale(), HtmlExportGUIModule.BASE_RESOURCE_CLASS, ObjectUtilities .getClassLoader( HtmlExportGUIModule.class ) ); } else { this.messages = new Messages( Locale.getDefault(), HtmlExportGUIModule.BASE_RESOURCE_CLASS, ObjectUtilities .getClassLoader( HtmlExportGUIModule.class ) ); throw new ReportProcessingException( messages.getErrorString( "HtmlDirExportTask.ERROR_0003_TARGET_FILE_EXISTS", targetFile.getAbsolutePath() ) ); //$NON-NLS-1$
/** * Get a parametrized formatted error message from the resource-bundle. The message consists of two parts. The first * part is the error numeric Id associated with the key used to identify the message in the resource file. For * instance, suppose the error key is MyClass.ERROR_0069_DONKEY_PUNCH. The first part of the error msg would be * "0069". The second part of the returned string is simply the <code>msg</code> parameter. * <p/> * Currently the format is: error key - error msg For instance: "0069 - You were punched by the donkey." * * @param key String containing the key that was used to obtain the <code>msg</code> parameter from the resource * file. * @param param1 the parameter for the message * @return String containing the formatted error message. */ public String getErrorString(final String key, final String... param1) { return formatErrorMessage(key, getString(key, param1)); } }
/** * Defines the layout text message. This text describes the prepare phases of the report processing. * * @param layoutText * the layout message. */ public void setLayoutText( final String layoutText ) { if ( layoutText == null ) { throw new NullPointerException( messages.getErrorString( "ReportProgressDialog.ERROR_0002_LAYOUT_TEXT_NULL" ) ); //$NON-NLS-1$ } this.layoutText = layoutText; }
/** * 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 String getString(final String key, final String... param1) { try { return formatMessage(key, param1); } catch (final MissingResourceException e) { return '!' + key + '!'; } }
/** * Returns the name of the encoding mapping. This is usually the same as the printer model name. * * @return the printer model. */ public String getName() { return EncodingSelector.MESSAGES.getString( "EncodingSelector.USER_GENERIC_PRINTER" ); //$NON-NLS-1$ }
/** * main Method to start the editor. * * @param args not used. */ public static void main( final String[] args ) { try { ConfigEditorBoot.getInstance().start(); final ConfigEditor ed = new ConfigEditor(); ed.pack(); ed.setVisible( true ); } catch ( Exception e ) { final Messages messages = new Messages ( Locale.getDefault(), ConfigEditorBoot.BUNDLE_NAME, ObjectUtilities.getClassLoader( ConfigEditorBoot.class ) ); final String message = messages.getString( "ConfigEditor.ERROR_0001_FAILED_TO_INITIALIZE" ); //$NON-NLS-1$ logger.debug( message, e ); JOptionPane.showMessageDialog( null, message ); } } }
this.statusListener = swingGuiContext.getStatusListener(); this.messages = new Messages( swingGuiContext.getLocale(), HtmlExportGUIModule.BASE_RESOURCE_CLASS, ObjectUtilities .getClassLoader( HtmlExportGUIModule.class ) ); } else { this.messages = new Messages( Locale.getDefault(), HtmlExportGUIModule.BASE_RESOURCE_CLASS, ObjectUtilities .getClassLoader( HtmlExportGUIModule.class ) ); .getErrorString( "HtmlZipExportTask.ERROR_0002_TARGET_FILE_EXISTS" ) ); //$NON-NLS-1$
public Messages getBundle( final Locale locale ) { if ( locale == null ) { throw new NullPointerException(); } if ( lastMessages == null || ObjectUtilities.equal( locale, lastLocale ) == false ) { lastMessages = new Messages( locale, bundleLocation, ObjectUtilities.getClassLoader( AbstractMetaData.class ) ); lastLocale = locale; } return lastMessages; }
/** * Exports a report. * * @param job * the report. * @return A boolean. */ public boolean performShowExportDialog( final MasterReport job, final String configKey ) { try { final Configuration configuration = job.getConfiguration(); final String dialogClassName = configuration.getConfigProperty( configKey ); final ExportDialog dialog = createExportDialog( dialogClassName ); return dialog.performQueryForExport( job, getContext() ); } catch ( InstantiationException e ) { AbstractExportActionPlugin.logger.error( messages .getErrorString( "AbstractExportActionPlugin.ERROR_0005_UNABLE_TO_CONFIGURE" ) ); //$NON-NLS-1$ getContext().getStatusListener().setStatus( StatusType.ERROR, messages.getString( "AbstractExportActionPlugin.ERROR_0005_UNABLE_TO_CONFIGURE" ), e ); //$NON-NLS-1$ return false; } }
/** * Sets the lines per inch. * * @param lpi * the lines per inch. */ public void setLinesPerInch( final float lpi ) { final Float lpiObj = new Float( lpi ); final ComboBoxModel model = cbLinesPerInch.getModel(); for ( int i = 0; i < model.getSize(); i++ ) { if ( lpiObj.equals( model.getElementAt( i ) ) ) { cbLinesPerInch.setSelectedIndex( i ); return; } } throw new IllegalArgumentException( messages.getErrorString( "PlainTextExportDialog.ERROR_0001_NO_SUCH_LPI", String .valueOf( lpi ) ) ); //$NON-NLS-1$ //$NON-NLS-2$ }