protected FilesystemFilter createReportFilter() { return new FilesystemFilter( new String[] { ".prpt", ".report", ".xml" }, "Reports", false ); } }
/** * Returns <code>true</code> if the specified file matches the requirements of this filter, and <code>false</code> * otherwise. * * @param dir the file or directory. * @return A boolean. */ public boolean accept( final File dir ) { if ( dir.isDirectory() && acceptsDirectories() ) { return true; } for ( int i = 0; i < fileext.length; i++ ) { if ( dir.getName().endsWith( this.fileext[ i ] ) ) { return true; } } return false; }
/** * Creates the file chooser. * * @return the initialized file chooser. */ protected JFileChooser createFileChooser() { final JFileChooser fc = new JFileChooser(); fc.addChoosableFileFilter( new FilesystemFilter( getFileExtension(), getFileDescription() ) ); fc.setMultiSelectionEnabled( false ); fc.setCurrentDirectory( getCurrentDirectory() ); return fc; }
/** * Returns <code>true</code> if the file is accepted, and <code>false</code> otherwise. * * @param dir the directory. * @param name the file name. * @return A boolean. */ public boolean accept( final File dir, final String name ) { final File f = new File( dir, name ); if ( f.isDirectory() && acceptsDirectories() ) { return true; } for ( int i = 0; i < fileext.length; i++ ) { if ( name.endsWith( this.fileext[ i ] ) ) { return true; } } return false; }
/** * selects a file to use as target for the report processing. */ protected void performSelectFile() { // lazy initialize ... the file chooser is one of the hot spots here ... if ( fileChooser == null ) { fileChooser = new JFileChooser(); final FilesystemFilter filter = new FilesystemFilter( PdfExportDialog.PDF_FILE_EXTENSION, getResources().getString( "file.save.pdfdescription" ) ); //$NON-NLS-1$ fileChooser.addChoosableFileFilter( filter ); fileChooser.setMultiSelectionEnabled( false ); } final File file = new File( txFilename.getText() ); fileChooser.setCurrentDirectory( file ); fileChooser.setSelectedFile( file ); final int option = fileChooser.showSaveDialog( this ); if ( option == JFileChooser.APPROVE_OPTION ) { final File selFile = fileChooser.getSelectedFile(); String selFileName = selFile.getAbsolutePath(); // Test if ends of pdf if ( selFileName.toLowerCase().endsWith( PdfExportDialog.PDF_FILE_EXTENSION ) == false ) { selFileName = selFileName + PdfExportDialog.PDF_FILE_EXTENSION; } txFilename.setText( selFileName ); } }
/** * Returns <code>true</code> if the specified file matches the requirements of this * filter, and <code>false</code> otherwise. * * @param dir the file or directory. * @return A boolean. */ public boolean accept(final File dir) { if (dir.isDirectory() && acceptsDirectories()) { return true; } for (int i = 0; i < fileext.length; i++) { if (dir.getName().endsWith(this.fileext[i])) { return true; } } return false; }
/** * Selects a file to use as target for the report processing. */ protected void performSelectFileZip() { final File file = new File( getFilename() ); if ( fileChooserZip == null ) { fileChooserZip = new JFileChooser(); fileChooserZip.addChoosableFileFilter( new FilesystemFilter( new String[] { HtmlZipExportDialog.ZIP_FILE_EXTENSION, HtmlZipExportDialog.JAR_FILE_EXTENSION }, getResources().getString( "htmlexportdialog.zip-archives" ), true ) ); //$NON-NLS-1$ fileChooserZip.setMultiSelectionEnabled( false ); } fileChooserZip.setCurrentDirectory( file ); fileChooserZip.setSelectedFile( file ); final int option = fileChooserZip.showSaveDialog( this ); if ( option == JFileChooser.APPROVE_OPTION ) { final File selFile = fileChooserZip.getSelectedFile(); String selFileName = selFile.getAbsolutePath(); // Test if ends on xls if ( StringUtils.endsWithIgnoreCase( selFileName, HtmlZipExportDialog.ZIP_FILE_EXTENSION ) == false ) { selFileName = selFileName + HtmlZipExportDialog.ZIP_FILE_EXTENSION; } setFilename( selFileName ); } }
/** * Returns <code>true</code> if the file is accepted, and <code>false</code> otherwise. * * @param dir the directory. * @param name the file name. * @return A boolean. */ public boolean accept(final File dir, final String name) { final File f = new File(dir, name); if (f.isDirectory() && acceptsDirectories()) { return true; } for (int i = 0; i < fileext.length; i++) { if (name.endsWith(this.fileext[i])) { return true; } } return false; }
/** * Selects a file to use as target for the report processing. */ protected void performSelectFile() { if ( fileChooser == null ) { fileChooser = new JFileChooser(); final FilesystemFilter filter = new FilesystemFilter( ExcelExportDialog.XLS_FILE_EXTENSION, getResources().getString( "excelexportdialog.excel-file-description" ) ); //$NON-NLS-1$ fileChooser.addChoosableFileFilter( filter ); fileChooser.setMultiSelectionEnabled( false ); } final File file = new File( getFilename() ); fileChooser.setCurrentDirectory( file ); fileChooser.setSelectedFile( file ); final int option = fileChooser.showSaveDialog( this ); if ( option == JFileChooser.APPROVE_OPTION ) { final File selFile = fileChooser.getSelectedFile(); String selFileName = selFile.getAbsolutePath(); // Test if ends on xls if ( StringUtils.endsWithIgnoreCase( selFileName, ExcelExportDialog.XLS_FILE_EXTENSION ) == false ) { selFileName = selFileName + ExcelExportDialog.XLS_FILE_EXTENSION; } setFilename( selFileName ); } }
/** * Selects a file to use as target for the report processing. */ protected void performSelectFile() { if ( fileChooser == null ) { fileChooser = new JFileChooser(); final FilesystemFilter filter = new FilesystemFilter( CSVDataExportDialog.CSV_FILE_EXTENSION, getResources().getString( "csvexportdialog.csv-file-description" ) ); //$NON-NLS-1$ fileChooser.addChoosableFileFilter( filter ); fileChooser.setMultiSelectionEnabled( false ); } fileChooser.setSelectedFile( new File( getFilename() ) ); final int option = fileChooser.showSaveDialog( this ); if ( option == JFileChooser.APPROVE_OPTION ) { final File selFile = fileChooser.getSelectedFile(); String selFileName = selFile.getAbsolutePath(); // Test if ends on csv if ( StringUtils.endsWithIgnoreCase( selFileName, CSVDataExportDialog.CSV_FILE_EXTENSION ) == false ) { selFileName = selFileName + CSVDataExportDialog.CSV_FILE_EXTENSION; } setFilename( selFileName ); } }
/** * Selects a file to use as target for the report processing. */ protected void performSelectFile() { if ( fileChooser == null ) { fileChooser = new JFileChooser(); final FilesystemFilter filter = new FilesystemFilter( CSVTableExportDialog.CSV_FILE_EXTENSION, getResources().getString( "csvexportdialog.csv-file-description" ) ); //$NON-NLS-1$ fileChooser.addChoosableFileFilter( filter ); fileChooser.setMultiSelectionEnabled( false ); } fileChooser.setSelectedFile( new File( getFilename() ) ); final int option = fileChooser.showSaveDialog( this ); if ( option == JFileChooser.APPROVE_OPTION ) { final File selFile = fileChooser.getSelectedFile(); String selFileName = selFile.getAbsolutePath(); // Test if ends on csv if ( StringUtils.endsWithIgnoreCase( selFileName, CSVTableExportDialog.CSV_FILE_EXTENSION ) == false ) { selFileName = selFileName + CSVTableExportDialog.CSV_FILE_EXTENSION; } setFilename( selFileName ); } }
/** * Selects a file to use as target for the report processing. */ protected void performSelectFile() { if ( fileChooser == null ) { fileChooser = new JFileChooser(); final FilesystemFilter filter = new FilesystemFilter( RTFExportDialog.RTF_FILE_EXTENSION, getResources().getString( "rtf-exportdialog.rtf-file-description" ) ); //$NON-NLS-1$ fileChooser.addChoosableFileFilter( filter ); fileChooser.setMultiSelectionEnabled( false ); } final File file = new File( getFilename() ); fileChooser.setCurrentDirectory( file ); fileChooser.setSelectedFile( file ); final int option = fileChooser.showSaveDialog( this ); if ( option == JFileChooser.APPROVE_OPTION ) { final File selFile = fileChooser.getSelectedFile(); String selFileName = selFile.getAbsolutePath(); // Test if ends on xls if ( StringUtils.endsWithIgnoreCase( selFileName, RTFExportDialog.RTF_FILE_EXTENSION ) == false ) { selFileName = selFileName + RTFExportDialog.RTF_FILE_EXTENSION; } setFilename( selFileName ); } }
/** * Selects a file to use as target for the report processing. */ protected void performSelectFile() { if ( fileChooser == null ) { fileChooser = new JFileChooser(); final FilesystemFilter filter = new FilesystemFilter( XSSFExcelExportDialog.XLS_FILE_EXTENSION, getResources().getString( "excelexportdialog.excel-file-description" ) ); //$NON-NLS-1$ fileChooser.addChoosableFileFilter( filter ); fileChooser.setMultiSelectionEnabled( false ); } final File file = new File( getFilename() ); fileChooser.setCurrentDirectory( file ); fileChooser.setSelectedFile( file ); final int option = fileChooser.showSaveDialog( this ); if ( option == JFileChooser.APPROVE_OPTION ) { final File selFile = fileChooser.getSelectedFile(); String selFileName = selFile.getAbsolutePath(); // Test if ends on xls if ( StringUtils.endsWithIgnoreCase( selFileName, XSSFExcelExportDialog.XLS_FILE_EXTENSION ) == false ) { selFileName = selFileName + XSSFExcelExportDialog.XLS_FILE_EXTENSION; } setFilename( selFileName ); } }
/** * Selects a file to use as target for the report processing. */ protected void performSelectFile() { final File file = new File( getFilename() ); if ( fileChooserHtml == null ) { fileChooserHtml = new JFileChooser(); fileChooserHtml.addChoosableFileFilter( new FilesystemFilter( new String[] { HtmlStreamExportDialog.HTML_FILE_EXTENSION, HtmlStreamExportDialog.HTM_FILE_EXTENSION }, getResources() .getString( "htmlexportdialog.html-documents" ), true ) ); //$NON-NLS-1$ fileChooserHtml.setMultiSelectionEnabled( false ); } fileChooserHtml.setCurrentDirectory( file ); fileChooserHtml.setSelectedFile( file ); final int option = fileChooserHtml.showSaveDialog( this ); if ( option == JFileChooser.APPROVE_OPTION ) { final File selFile = fileChooserHtml.getSelectedFile(); String selFileName = selFile.getAbsolutePath(); // Test if ends on html if ( ( StringUtils.endsWithIgnoreCase( selFileName, HtmlStreamExportDialog.HTML_FILE_EXTENSION ) == false ) && ( StringUtils.endsWithIgnoreCase( selFileName, HtmlStreamExportDialog.HTM_FILE_EXTENSION ) == false ) ) { selFileName = selFileName + HtmlStreamExportDialog.HTML_FILE_EXTENSION; } setFilename( selFileName ); } }
/** * Selects a file to use as target for the report processing. */ protected void performSelectFile() { final File file = new File( getFilename() ); if ( fileChooserHtml == null ) { fileChooserHtml = new JFileChooser(); fileChooserHtml.addChoosableFileFilter( new FilesystemFilter( new String[] { HtmlDirExportDialog.HTML_FILE_EXTENSION, HtmlDirExportDialog.HTM_FILE_EXTENSION }, getResources().getString( "htmlexportdialog.html-documents" ), true ) ); //$NON-NLS-1$ fileChooserHtml.setMultiSelectionEnabled( false ); } fileChooserHtml.setCurrentDirectory( file ); fileChooserHtml.setSelectedFile( file ); final int option = fileChooserHtml.showSaveDialog( this ); if ( option == JFileChooser.APPROVE_OPTION ) { final File selFile = fileChooserHtml.getSelectedFile(); String selFileName = selFile.getAbsolutePath(); // Test if ends on html if ( ( StringUtils.endsWithIgnoreCase( selFileName, HtmlDirExportDialog.HTML_FILE_EXTENSION ) == false ) && ( StringUtils.endsWithIgnoreCase( selFileName, HtmlDirExportDialog.HTM_FILE_EXTENSION ) == false ) ) { selFileName = selFileName + HtmlDirExportDialog.HTML_FILE_EXTENSION; } setFilename( selFileName ); } }
/** * Saves the report configuration to a user selectable report properties file. */ protected void save() { setStatusText( resources.getString( "ConfigEditor.USER_SAVING" ) ); //$NON-NLS-1$ editorPane.commit(); if ( fileChooser == null ) { fileChooser = new JFileChooser(); final FilesystemFilter filter = new FilesystemFilter ( ConfigEditor.PROPERTIES_FILE_EXTENSION, resources.getString( "config-editor.file-description.properties" ) ); //$NON-NLS-1$ fileChooser.addChoosableFileFilter( filter ); fileChooser.setMultiSelectionEnabled( false ); } final int option = fileChooser.showSaveDialog( this ); if ( option == JFileChooser.APPROVE_OPTION ) { final File selFile = fileChooser.getSelectedFile(); String selFileName = selFile.getAbsolutePath(); // Test if ends on xls if ( StringUtils.endsWithIgnoreCase( selFileName, ConfigEditor.PROPERTIES_FILE_EXTENSION ) == false ) { selFileName = selFileName + ConfigEditor.PROPERTIES_FILE_EXTENSION; } write( selFileName ); } }
private void init() { this.resources = Messages.getInstance(); setTitle( resources.getString( "config-description-editor.title" ) ); //$NON-NLS-1$ final JPanel contentPane = new JPanel(); contentPane.setLayout( new BorderLayout() ); detailEditorPane = createEditPane(); final JSplitPane splitPane = new JSplitPane ( JSplitPane.HORIZONTAL_SPLIT, createEntryList(), detailEditorPane ); contentPane.add( splitPane, BorderLayout.CENTER ); contentPane.add( createButtonPane(), BorderLayout.SOUTH ); final JPanel cPaneStatus = new JPanel(); cPaneStatus.setLayout( new BorderLayout() ); cPaneStatus.add( contentPane, BorderLayout.CENTER ); cPaneStatus.add( createStatusBar(), BorderLayout.SOUTH ); setContentPane( cPaneStatus ); setEntryType( ConfigDescriptionEditor.TYPE_TEXT ); setSelectedEntry( null ); fileChooser = new JFileChooser(); fileChooser.addChoosableFileFilter( new FilesystemFilter ( ".xml", resources.getString( "config-description-editor.xml-files" ) ) ); //$NON-NLS-1$ //$NON-NLS-2$ fileChooser.setMultiSelectionEnabled( false ); setStatusText( resources.getString( "config-description-editor.welcome" ) ); //$NON-NLS-1$ addWindowListener( new CloseHandler() ); }
if ( fileChooser == null ) { fileChooser = new JFileChooser(); final FilesystemFilter filter = new FilesystemFilter ( ConfigEditor.PROPERTIES_FILE_EXTENSION, resources.getString( "config-editor.file-description.properties" ) ); //$NON-NLS-1$
public static File locateGoldenSampleReport( final String name ) { final FilesystemFilter filesystemFilter = new FilesystemFilter( name, "Reports" ); final File marker = findMarker(); final String[] directories = new String[] { "reports", "reports-4.0" }; for ( int i = 0; i < directories.length; i++ ) { final String directory = directories[i]; final File reports = new File( marker, directory ); final File[] files = reports.listFiles( filesystemFilter ); final HashSet<String> fileSet = new HashSet<String>(); if ( files != null ) { for ( final File file : files ) { final String s = file.getName().toLowerCase(); if ( fileSet.add( s ) == false ) { // the toy systems MacOS X and Windows use case-insensitive file systems and completely // mess up when there are two files with what they consider the same name. throw new IllegalStateException( "There is a golden sample with the same Windows/Mac " + "filename in the directory. Make sure your files are unique and lowercase." ); } } for ( final File file : files ) { if ( file.isDirectory() ) { continue; } return file; } } } return null; }