Package net.sourceforge.processdash.ui.lib

Examples of net.sourceforge.processdash.ui.lib.ExampleFileFilter


            return result;
        }
       
        private ExampleFileFilter getFilter(String key, String suffix) {
            String description = getString("Choose_File.Description" + key);
            return new ExampleFileFilter(suffix.substring(1), description);
        }
View Full Code Here


        fc.setSelectedFile(new File(getDefaultDirectory(fc),
                defaultFilename));
        fc.setDialogTitle(resources.getString("Save_Backup.Window_Title"));
        String defaultType = Settings.getVal(TYPE_PREF, ZIP);
        for (String type : BACKUP_FILE_TYPES) {
            ExampleFileFilter filter = makeFilter(type);
            fc.addChoosableFileFilter(filter);
            if (type.equalsIgnoreCase(defaultType))
                fc.setFileFilter(filter);
        }

        if (fc.showSaveDialog(null) != JFileChooser.APPROVE_OPTION)
            return null;

        File dest = fc.getSelectedFile();
        saveDefaultDirectory(dest);
        if (dest == null)
            return null;

        ExampleFileFilter ff = (ExampleFileFilter) fc.getFileFilter();
        File result = ff.maybeAppendExtension(dest);
        String resultType = ff.getExtension(result);
        if (StringUtils.hasValue(resultType))
            InternalSettings.set(TYPE_PREF, resultType);
        return result;
    }
View Full Code Here

    public File selectBackupFile(Component parent, String title) {
        JFileChooser fc = new JFileChooser();
        if (lastBackupDirectory != null)
            fc.setCurrentDirectory(lastBackupDirectory);
        fc.setDialogTitle(title);
        ExampleFileFilter ff = makeFilter(PDBK);
        for (String type : BACKUP_FILE_TYPES)
            ff.addExtension(type);
        fc.addChoosableFileFilter(ff);
        fc.setFileFilter(ff);
       
        if (fc.showOpenDialog(parent) != JFileChooser.APPROVE_OPTION)
            return null;
View Full Code Here

    }

    private ExampleFileFilter makeFilter(String ext) {
        String descr = resources.getString("Save_Backup." + ext
                + ".File_Description");
        return new ExampleFileFilter(ext, descr);
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.processdash.ui.lib.ExampleFileFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.