Examples of FileChooser


Examples of org.wiztools.filechooser.FileChooser

    }
   
    @Override
    public File getOpenFile(final FileChooserType type, final Component parent){
        String title = null;
        FileChooser jfc = null;
        if(type == FileChooserType.OPEN_REQUEST){
            jfc = jfc_request;
            title = "Open Request";
        }
        else if(type == FileChooserType.OPEN_RESPONSE){
            jfc = jfc_response;
            title = "Open Response";
        }
        else if(type == FileChooserType.OPEN_ARCHIVE){
            jfc = jfc_archive;
            title = "Open Req-Res Archive";
        }
        else if(type == FileChooserType.OPEN_REQUEST_BODY){
            jfc = jfc_generic;
            title = "Open Request Body";
        }
        else if(type == FileChooserType.OPEN_HISTORY) {
            jfc = jfc_history;
            title = "Open History";
        }
        else if(type == FileChooserType.OPEN_TEST_SCRIPT){
            jfc = jfc_generic;
            title = "Open Test Script";
        }
        else if(type == FileChooserType.OPEN_GENERIC){
            jfc = jfc_generic;
            title = "Open";
        }
        jfc.setDialogTitle(title);
        FileChooserResponse status = jfc.showOpenDialog(parent);
        if(status == FileChooserResponse.APPROVE_OPTION){
            File f = jfc.getSelectedFile();
            saveLastDir(type, f.getParentFile());
            return f;
        }
        return null;
    }
View Full Code Here

Examples of org.wiztools.filechooser.FileChooser

    }
   
    // This method is invoked from SU.invokeLater
    @Override
    public File getSaveFile(final FileChooserType type){
        FileChooser jfc = null;
        String title = null;
        if(type == FileChooserType.SAVE_REQUEST){
            jfc = jfc_request;
            title = "Save Request";
        }
        else if(type == FileChooserType.SAVE_RESPONSE){
            jfc = jfc_response;
            title = "Save Response";
        }
        else if(type == FileChooserType.SAVE_RESPONSE_BODY){
            jfc = jfc_generic;
            title = "Save Response Body";
        }
        else if(type == FileChooserType.SAVE_ARCHIVE){
            jfc = jfc_archive;
            title = "Save Req-Res Archive";
        }
        else if(type == FileChooserType.SAVE_HISTORY) {
            jfc = jfc_history;
            title = "Save History";
        }
        jfc.setDialogTitle(title);
        FileChooserResponse status = jfc.showSaveDialog(frame);
        if(status == FileChooserResponse.APPROVE_OPTION){
            File f = jfc.getSelectedFile();
           
            if(f == null){
                return null;
            }
           
            String ext = null;
            switch(type){
                case SAVE_REQUEST:
                    ext = FileType.REQUEST_EXT;
                    break;
                case SAVE_RESPONSE:
                    ext = FileType.RESPONSE_EXT;
                    break;
                case SAVE_ARCHIVE:
                    ext = FileType.ARCHIVE_EXT;
                    break;
                default:
                    break;
            }
            if(ext != null){
                String path = f.getAbsolutePath();
                path = path.toLowerCase();
                // Add our extension only if the selected filter is ours
                FileFilter ff = jfc.getFileFilter();
                RCFileFilter rcFileFilter = null;
                if(ff instanceof RCFileFilter){
                    rcFileFilter = (RCFileFilter)ff;
                }
                if((rcFileFilter != null) &&
                        (rcFileFilter.getFileTypeExt().equals(ext)) &&
                        !path.endsWith(ext)){
                    f = new File(f.getAbsolutePath() + ext);
                    jfc.setSelectedFile(f);
                    view.setStatusMessage("Adding default extension: " + ext);
                }
            }
            if(f.exists()){
                int yesNo = JOptionPane.showConfirmDialog(frame,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.