reportProcessor = createReportProcessor( fout ); reportProcessor.processReport(); statusListener.setStatus( StatusType.INFORMATION, messages.getString( "ReportExportTask.USER_EXPORT_COMPLETE" ), //$NON-NLS-1$ null ); reportProcessor.close();
/** * 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$ } }
/** * 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$ }
/** * Defines an <code>Action</code> object with a default description string and default icon. */ private UpdateAction() { putValue( Action.NAME, messages.getString( "ParameterReportControllerPane.Update" ) ); }
/** * This method gets called when a bound property is changed. * * @param evt * A PropertyChangeEvent object describing the event source and the property that has changed. */ public void propertyChange( final PropertyChangeEvent evt ) { try { final Locale locale = target.getLocale(); final ResourceBundle bundle = ResourceBundle.getBundle( resourceBundleName, locale ); final String string = bundle.getString( resourceKey ); target.setText( string ); } catch ( IllegalComponentStateException ice ) { target.setText( messages.getString( "USER_NO_PARENT_ERROR", resourceKey ) ); //$NON-NLS-1$ } catch ( MissingResourceException mre ) { target.setText( messages.getString( "USER_NO_PARENT_ERROR", resourceKey ) ); //$NON-NLS-1$ target.setText( messages.getString( "USER_MISSING_RESOURCE_ERROR", resourceKey ) ); //$NON-NLS-1$ } } }
public String getDisplayName( final Locale locale ) { return getBundle( locale ).getString( displayNameKey ); }
/** * 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 ) ); } }
/** * 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)); } }
/** * Reads the stacktrace text from the exception. * * @param e * the exception. * @return the stack trace. * @noinspection IOResourceOpenedButNotSafelyClosed */ private String readFromException( final Exception e ) { String text = messages.getString( "ExceptionDialog.USER_NO_BACKTRACE" ); //$NON-NLS-1$ try { final MemoryStringWriter writer = new MemoryStringWriter(); final PrintWriter pwriter = new PrintWriter( writer ); e.printStackTrace( pwriter ); text = writer.toString(); pwriter.close(); } catch ( Exception ex ) { ExceptionDialog.logger.info( messages.getString( "ExceptionDialog.INFO_EXCEPTION_SUPRESSED" ) ); //$NON-NLS-1$ } return text; }
/** * 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; }
/** * Defines an <code>Action</code> object with a default description string and default icon. */ public SelectionAction() { putValue( Action.NAME, EditorMessages.getInstance().getString( "AbstractStringValueCellEditor.SelectValue" ) ); }
protected void performUpdate() { isUpdating = true; try { report.getParameterValues().clear(); report.getParameterValues().putAll( reportParameterValues ); setReport( report ); final ChangeEvent event = new ChangeEvent( this ); for ( int i = 0; i < changeListeners.size(); i++ ) { final ChangeListener listener = changeListeners.get( i ); listener.stateChanged( event ); } } catch ( ReportProcessingException e ) { ExceptionDialog.showExceptionDialog( this, messages.getString( "ParameterReportControllerPane.Error" ), messages .getString( "ParameterReportControllerPane.ErrorWhileConfiguringParameterUI", e.getMessage() ), e ); } isUpdating = false; }
private Configuration loadFromConfigStore( final MasterReport reportJob, final Configuration defaultConfig ) { final String configPath = ConfigFactory.encodePath( reportJob.getTitle() + getConfigurationSuffix() ); final ConfigStorage storage = ConfigFactory.getInstance().getUserStorage(); try { return storage.load( configPath, defaultConfig ); } catch ( Exception cse ) { AbstractExportDialog.logger.debug( messages.getString( "AbstractExportDialog.DEBUG_CANT_LOAD_DEFAULTS", String .valueOf( getClass() ) ) ); //$NON-NLS-1$ //$NON-NLS-2$ } return defaultConfig; }
private void createParametersPanelContent() { final ReportParameterDefinition theParamterDefinition = reportJob.getParameterDefinition(); if ( theParamterDefinition.getParameterCount() > 0 ) { try { parametersPanel.hideControls(); parametersPanel.setReport( reportJob ); } catch ( ReportProcessingException e ) { parametersPanel.setErrorMessage( messages.getString( "AbstractExportDialog.ERROR_PARAMETERS" ) ); } } else { parametersPanel.setErrorMessage( messages.getString( "AbstractExportDialog.NO_PARAMETERS" ) ); } }
private void saveToConfigStore( final MasterReport reportJob, final Configuration reportConfiguration ) { final String configPath = ConfigFactory.encodePath( reportJob.getTitle() + getConfigurationSuffix() ); try { final boolean fullStorageEnabled = isFullInputStorageEnabled( reportConfiguration ); final Configuration dialogContents = grabDialogContents( fullStorageEnabled ); final ConfigStorage storage = ConfigFactory.getInstance().getUserStorage(); storage.store( configPath, dialogContents ); } catch ( ConfigStoreException cse ) { AbstractExportDialog.logger.debug( messages.getString( "AbstractExportDialog.DEBUG_CANT_STORE_DEFAULTS", String .valueOf( getClass() ) ) ); //$NON-NLS-1$//$NON-NLS-2$ } }
/** * 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 { PrintUtil.print( job, new OnDemandShowProgressListener( progressListener ) ); } catch ( Exception e ) { if ( statusListener != null ) { statusListener.setStatus( StatusType.ERROR, messages.getString( "PrintExportTask.USER_EXPORT_FAILED" ), e ); //$NON-NLS-1$ } PrintExportTask.logger.error( "Printing Failed", e ); //$NON-NLS-1$ } finally { if ( progressListener != null ) { progressListener.setVisible( false ); } } }
protected void initializeWithoutJob() { if ( printReportProcessor != null ) { printReportProcessor.close(); printReportProcessor = null; } setTitle( messages.getString( "PreviewPane.EMPTY_TITLE" ) ); //$NON-NLS-1$ final Configuration configuration = ClassicEngineBoot.getInstance().getGlobalConfig(); setIconTheme( PreviewPaneUtilities.createIconTheme( configuration ) ); performInitialization( configuration ); }
/** * Initializes the dialog (Non-GUI stuff). */ private void initConstructor() { updateRunnable = new ScreenUpdateRunnable(); messages = new Messages( getLocale(), SwingCommonModule.BUNDLE_NAME, ObjectUtilities .getClassLoader( SwingCommonModule.class ) ); initialize(); addWindowListener( new ToFrontHandler() ); setOutputText( messages.getString( "progress-dialog.perform-output" ) ); //$NON-NLS-1$ setLayoutText( messages.getString( "progress-dialog.prepare-layout" ) ); //$NON-NLS-1$ lastActivity = -1; lastMaxRow = -1; lastPage = -1; this.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE ); pack(); LibSwingUtil.centerDialogInParent( this ); }
public synchronized void startPagination() { killThePaginationWorker(); if ( printReportProcessor != null ) { printReportProcessor.close(); printReportProcessor = null; } // Reset the pagination to automatic mode now. This way changes to the page-format will trigger // pagination again in a safe manor. deferredRepagination = false; try { final MasterReport reportJob = getReportJob(); printReportProcessor = new PrintReportProcessor( reportJob ); paginationWorker = createWorker(); paginationWorker.setWorkload( new RepaginationRunnable( printReportProcessor ) ); } catch ( ReportProcessingException e ) { PreviewPane.logger.error( "Unable to start report pagination:", e ); // NON-NLS setStatusType( StatusType.ERROR ); setStatusText( messages.getString( "PreviewPane.ERROR_ON_PAGINATION" ) ); } }
protected void initializeFromReport() { final PageDefinition pageDefinition = reportJob.getPageDefinition(); if ( pageDefinition.getPageCount() > 0 ) { final PageFormat pageFormat = pageDefinition.getPageFormat( 0 ); pageDrawable.setDefaultWidth( (int) pageFormat.getWidth() ); pageDrawable.setDefaultHeight( (int) pageFormat.getHeight() ); } if ( reportJob.getTitle() == null ) { setTitle( messages.getString( "PreviewPane.EMPTY_TITLE" ) ); //$NON-NLS-1$ } else { setTitle( messages.getString( "PreviewPane.PREVIEW_TITLE", reportJob.getTitle() ) ); //$NON-NLS-1$ } final Configuration configuration = reportJob.getConfiguration(); setIconTheme( PreviewPaneUtilities.createIconTheme( configuration ) ); performInitialization( configuration ); if ( deferredRepagination == false ) { startPagination(); } }