/** * 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$ } }
/** * 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; }
/** * 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; }
/** * 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$ }
/** * Sets the characters per inch. * * @param cpi * the characters per inch. */ public void setCharsPerInch( final float cpi ) { final Float cpiObj = new Float( cpi ); final ComboBoxModel model = cbCharsPerInch.getModel(); for ( int i = 0; i < model.getSize(); i++ ) { if ( cpiObj.equals( model.getElementAt( i ) ) ) { cbCharsPerInch.setSelectedIndex( i ); return; } } throw new IllegalArgumentException( messages.getErrorString( "PlainTextExportDialog.ERROR_0002_NO_SUCH_CPI", String .valueOf( cpi ) ) ); //$NON-NLS-1$ //$NON-NLS-2$ }
/** * Returns the encoding definition for the given java encoding. * * @param encoding * the java encoding that should be mapped into a printer specific encoding. * @return the printer specific encoding. * @throws IllegalArgumentException * if the given encoding is not supported. */ public PrinterEncoding getEncoding( final String encoding ) { if ( isEncodingSupported( encoding ) == false ) { throw new IllegalArgumentException( EncodingSelector.MESSAGES .getErrorString( "EncodingSelector.ERROR_0001_ENCODING_NOT_SUPPORTED" ) ); //$NON-NLS-1$ } return new PrinterEncoding( encoding, encoding, encoding, GenericPrinterSpecification.EMPTY_ARRAY ); }
return (ExportDialog) constructor.newInstance( new Object[] { proxy } ); } catch ( Exception e ) { AbstractExportActionPlugin.logger.error( messages.getErrorString( "AbstractExportActionPlugin.ERROR_0001_FAILED_EXPORT_DIALOG_CREATION", className ) ); //$NON-NLS-1$ return (ExportDialog) constructor.newInstance( new Object[] { proxy } ); } catch ( Exception e ) { AbstractExportActionPlugin.logger.error( messages.getErrorString( "AbstractExportActionPlugin.ERROR_0002_FAILED_EXPORT_DIALOG_CREATION", className ), e ); //$NON-NLS-1$ AbstractExportActionPlugin.logger.error( messages.getErrorString( "AbstractExportActionPlugin.ERROR_0003_FAILED_EXPORT_DIALOG_CREATION", className ) ); //$NON-NLS-1$ throw new InstantiationException( messages .getErrorString( "AbstractExportActionPlugin.ERROR_0004_FAILED_EXPORT_DIALOG_CREATION" ) ); //$NON-NLS-1$
/** * Make sure, that this encoding is defined and selectable in the combobox model. * * @param encoding * the encoding that should be verified. */ public void ensureEncodingAvailable( final String encoding ) { if ( encoding == null ) { throw new NullPointerException( messages .getErrorString( "EncodingComboBoxModel.ERROR_0001_ENCODING_CANNOT_BE_NULL" ) ); //$NON-NLS-1$ } final String desc = getEncodingDescription( encoding ); final EncodingCarrier ec = new EncodingCarrier( encoding, desc ); if ( encodings.contains( ec ) == false ) { encodings.add( ec ); fireContentsChanged(); } }
/** * Defines the selected index for this encoding model. * * @param index * the selected index or -1 to clear the selection. * @throws java.lang.IllegalArgumentException * if the given index is invalid. */ public void setSelectedIndex( final int index ) { if ( index == -1 ) { selectedIndex = -1; selectedObject = null; fireContentsChanged( -1, -1 ); return; } if ( index < -1 || index >= getSize() ) { throw new IllegalArgumentException( messages.getErrorString( "EncodingComboBoxModel.ERROR_0001_INVALID_INDEX" ) ); //$NON-NLS-1$ } selectedIndex = index; selectedObject = getElementAt( index ); fireContentsChanged( -1, -1 ); }
throw new ReportProcessingException( messages.getErrorString( "HtmlDirExportTask.ERROR_0003_TARGET_FILE_EXISTS", targetFile.getAbsolutePath() ) ); //$NON-NLS-1$
if ( targetFile.exists() ) { if ( targetFile.delete() == false ) { throw new ReportProcessingException( messages.getErrorString( "PdfExportTask.ERROR_0001_TARGET_EXISTS" ) ); //$NON-NLS-1$
public void setEncodings( final PrinterSpecification printerSpecification, final Locale locale ) { if ( printerSpecification == null ) { throw new NullPointerException( EncodingSelector.MESSAGES .getErrorString( "EncodingSelector.ERROR_0002_NULL_SPECIFICATION" ) ); //$NON-NLS-1$ } final EncodingComboBoxModel defaultEncodingModel = EncodingComboBoxModel.createDefaultModel( locale ); final EncodingComboBoxModel retval = new EncodingComboBoxModel( locale ); for ( int i = 0; i < defaultEncodingModel.getSize(); i++ ) { final String encoding = defaultEncodingModel.getEncoding( i ); if ( printerSpecification.isEncodingSupported( encoding ) ) { final String description = defaultEncodingModel.getDescription( i ); retval.addEncoding( encoding, description ); } } retval.sort(); final Object oldSelectedValue = encodingComboBox.getSelectedItem(); encodingComboBox.setModel( retval ); encodingComboBoxModel = retval; encodingComboBoxModel.setSelectedItem( oldSelectedValue ); } }
config.getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.html.stream.TargetFileName" ); //$NON-NLS-1$ if ( targetFileName == null ) { throw new ReportProcessingException( messages.getErrorString( "HtmlStreamExportTask.ERROR_0002_TARGET_NOT_SET" ) ); //$NON-NLS-1$ throw new ReportProcessingException( messages.getErrorString( "HtmlStreamExportTask.ERROR_0003_TARGET_FILE_EXISTS", targetFile.getAbsolutePath() ) ); //$NON-NLS-1$
.getErrorString( "HtmlZipExportTask.ERROR_0002_TARGET_FILE_EXISTS" ) ); //$NON-NLS-1$
/** * 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; } }
if ( filename == null ) { throw new ReportProcessingException( messages .getErrorString( "RTFExportTask.RTFExportTask.ERROR_0001_NULL_FILENAME" ) ); //$NON-NLS-1$
new Messages( Locale.getDefault(), SwingCommonModule.BUNDLE_NAME, ObjectUtilities .getClassLoader( SwingCommonModule.class ) ); logger.error( messages.getErrorString( "ExceptionDialog.ERROR_0001_USER_ERROR" ), e ); //$NON-NLS-1$